The fact that LINQ works item at a time instead of collection at a time is all that's being discussed. If you have ever used C#'s LINQ you are using transducers. > That seems like insufficient magic for the respect that transducers seem to have. But I guess that's what you need to go through in order to get good performance. I still write them sometimes, but it's never a walk in the park (it does provide satisfaction when done, though). As in, well, really hard (hope you remembered to flush using `unreduced` in your single-arity version!). One gripe I have with transducers is that writing stateful transducers is hard. On a higher level, I found myself thinking about business logic (model) in terms of transducer pipelines and ended up with a number of reusable transformations, and clearly specified pipeline logic. Even if I'm just applying a single transformation, this lets me quickly change the resulting collection and easily add more transformations if needed. Once you get used to them, they become a very natural tool - in my case, almost every time I do something to a sequence, I'll start with `into`. They are incredibly useful, allow for composable and reusable code, and come with really nice performance benefits as well (by not creating intermediate collections). Transducers are an under-appreciated feature in Clojure. (nb: I used to work for Metabase but currently do not. Metabase is not materially faster than other BI tools (because all the other BI tools do something vaguely similar in their langs and because the limiting factor is still the actual query running in most cases) but it's pretty comparable speed and the whole thing was materially written by like 5 peeps. There's a query cache and lots of other stuff, you need state, but you also need it to be basically fast. Whole processing from MBQL -> your SQL or whatever is done via a buncha big-ass transducers. End user does not usually write MBQL, it's a service for the frontend querybuilding UI thing and lots of other frontend UI stuff mainly in usage. Like basically all BI tools they have this intermediate representation language thing so you write the same thing in "MBQL (metabase query language)" and it theoretically becomes same query in like, Postgres and Mongo and whatever. Metabase is a BI tool, backend written mostly in Clojure.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |