8 minutes ago · 9 min read1807 words · Tech · hide

One aspect of Clojure that I've always liked is that it is, first and foremost, a pragmatic language. It will steer you towards using functional style by default, but it also offers imperative escape hatches for performance. For example, transients are used for cases when you need to build up a big vector in a tight loop. We can mutate a transient freely, then hand back an immutable value at the end by calling persistent!. What makes transients safe is that the mutation is explicitly scoped since any further attempt to mutate the data after persistent! was called throws. So, we can have the performance benefit of working with mutable data in a local scope, and the semantics of transients ensure that it can't leak to the outer context.I decided to see if I could apply a similar pattern at an even lower level in Jolt, which resulted in the idea of having native regions. A region drops out of the managed runtime entirely to run as plain C, then returns an Jolt array at the end:(require…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town