Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

I'm trying to reduce the size of our js bundle, and found out that for a historical reason we have Specter as a dependency. Its optimized size is 198.23 KB (really big guy). Also I haven't found any benchmark for ClojureScript, there is just an issue https://github.com/nathanmarz/specter/issues/141.

I wonder does anyone use it in production (CLJS)? What about benchmarks?

2 Answers

+2 votes
by

Hi Aleksandr,
we use Specter within CLJS at Powernoodle.com for object transformations and sub-selections from large nested map structures. We are using om/next and our state is stored in a very complex map. Where Specter really shines is when you need to change an existing data structure and get back the same type of structure, unlike using normal clojure functions that tend to return sequables regardless of the input. Once you grok the syntax and how it is used Specter is a very powerful tool and creates very intuitive and readable code. Also @nathanmarz is super helpful on the Clojure/Specter Slack channel - a big thanks to him just for dreaming it up. I don't have any benchmarks however, and to be honest without it our code would end up more complex and all Clojurists hate complected code ;-)
Ian

by
Thanks for answering! I completely agree with you about complex code.

I found that in our project it is used not much, just in few places, and now it's not obvious is it worth it or not, especially in the context of bundle size.

Anyway I'd like to see benchmarks for ClojureScript.
+2 votes
by

Not an exact benchmark, but when I refactored a pure ClojureScript code based on walk into one using Specter (in a code that was doing some recursive transformation), the UI went from non-responsive for up to several seconds on slow devices to much faster and bearable on slow devices. IIRC the gain was 2 orders of magnitude faster (~100ms => ~2ms), thanks to a custom Specter navigator.

...