Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Cool. How does it stack against bb ?
To be honest, I was quite surprised that people would use babashka for Advent of Code and that it performed quite well on most solutions. But uclj shows there are more optimizations to be made, in particular to function calls and loops. In SCI (the interpreter used in babashka) function arguments are bound using immutable maps. In uclj this is done using mutable arrays, which probably explains much of the performance difference when you have a high number of function calls / loops. I've had an open issue about this in SCI for a long time: https://github.com/babashka/sci/issues/416 but I feared that introducing mutable arrays would somehow not play well with multi-threading. Looking at the implementation in uclj, I think erdos figured out a way how to do this properly. Kudos to him. I look forward bringing this (and possible other) optimizations to SCI as well.
Starting this project was inspired by going further with the answer to this stackoverflow question: https://stackoverflow.com/questions/70235356/macroexpand-doseq-in-babashka-vs-in-clojure I found that macroexpansion in SCI often results in different expressions than in JVM Clojure, and that is because SCI uses a different set of special forms for its implementation. My theory was that if we can mimic how Clojure works on the low level, we could reuse a large portion of already existing infrastructure. (like my assertions library) The idea seems to work out so far and this is why core.async works out of the box with uclj.
Related posts
- What's the value proposition of meta circular interpreters?
- Sci: Configurable Clojure/Script interpreter suitable for scripting
- Embedding cherry in an existing CLJS app for runtime eval
- Compiled and Interpreted Languages: Two Ways of Saying Tomato
- Third party integrations with a monolithic Clojure app