Julia 1.5 tackles latency and heap allocations before tossing in another LTS release

Julia 1.5 tackles latency and heap allocations before tossing in another LTS release

After thorough testing, programming language Julia 1.5 has finally landed in its finished form with highly anticipated features aiming for lower latency and a reduction in heap allocations amongst other things.

The latter was implemented through a redesign of layout optimisations for immutable objects. This allows the compiler to track multiple roots inside object fields so that immutable objects that reference mutable ones can be stack allocated, passed and returned by value, and stored inline. The efficiency gain here is worth pointing out, because a variety of abstractions can only be realised through wrapping mutable objects in structs (which can be immutable).

Multithreading, which was introduced in version 0.5, has moved closer to becoming a production-ready feature in Julia 1.5 with most of the thread API marked as stable. It now comes with a command line option to specify the number of threads that should be used and another one in open which is supposed to speed up single-thread file access. 

In order to be able to change the default schedule in the future, the development team added a @threads: static syntax to request the current default threaded loop schedule.  Thread-safety has been a major theme for the API as well, which is why type definitions, global assignments, modules, @sync, and SuiteSparse bindings should now score better in this area.

Julia also received a shorthand for implicit keyword or named tuple values. This allows developers to for example type printstyled(“text”; color) instead of printstyled(“text”; color = color) or (; name, value, type) instead of (name = name, value = value, type = type), which some find more readable. Talking of syntax, version 1.5 has incorporated a @ccall macro that helps to style calls to C functions in a way more similar to ordinary function calls. 

Other enhancements in Julia 1.5 include a way of providing an optimization level hint in each module and some improvements to get compiler performance up. Both are supposed to cut the often mentioned time-to-first-plot down, which should help to make the language more attractive to new users. Along the same lines, the recently introduced pkg protocol to install and update Julia packages has been made the default for a better user experience. More information can be found in the company blog.

Though version 1.5 was just released, language creators Jeff Bezanson and Stefan Karpinski used last week’s JuliaCon to provide some insight into Julia 1.6. The next version will supersede Julia 1.0 as a long term support release, as 1.0 is getting “hard to support in packages” according to Karpinski. To make sure 1.6 has everything needed for a LTS version, the development team will step away from their usual approach of doing a timed release. 

Instead, the team will wait for a couple of specific features to be ready before pushing out a candidate for feedback. Julia 1.6, for example, is planned to include a couple of package manager improvements such as reworked artifacts to speed up the loading process and resource diffs for faster updates. Other additions are global package configurations and preferences, which are both said to help users to avoid having to mutate the state of a package itself. 

“Some packages use their own directory as a scratch space – a place to save some data that they downloaded or whatever” Karpinski explained. “That’s not great because you want your packages to be perfectly immutable and perfectly reproducible. So scratch spaces are a first class way of providing packages with a little bit of room for a mutable state. It’s okay if it goes away, because they can reconstruct it. And preferences are just a way to globally configure your packages on a system.”

According to Karpinski, 1.6 is on track for it’s planned feature freeze on August 31, though the associated milestones currently are at 38 per cent, meaning it could take a little while longer.

The news hit just days after Julia for VS Code, a VS Code extension succeeding the Atom-based Juno IDE, reached version 1.0.