The Julia team yesterday announced a new version of the language, Julia v1.3. A few highlights of this release include new language features such as support for Unicode 12.1.0, support for Unicode bold digits and double-struck digits 0 through 9 as valid identifiers, and many more.

What’s new in Julia v1.3?

In this latest Julia v1.3, methods can now be added to an abstract type. Also, the syntax var”#str#” for printing and parsing non-standard variable names have been added.

Multi-threading changes

  • New experimental Threads.@spawn macro runs a task on any available thread.
  • All system-level I/O operations (e.g. files and sockets) are now thread-safe. This does not include subtypes of IO that are entirely in-memory, such as IOBuffer, although it specifically does include BufferStream.
  • The global random number generator (GLOBAL_RNG) is now thread-safe (and thread-local).
  • New Channel(f::Function, spawn=true) keyword argument to schedule the created Task on any available thread, matching the behavior of Threads.@spawn.
  • Simplified the Channel constructor, which is now easier to read and more idiomatic julia. Use of the keyword arguments csize and ctype is now discouraged.

New library functions

Standard library changes

  • Regex can now be multiplied (*) and exponentiated (^), like strings.
  • Cmd interpolation (`$(x::Cmd) a b c` where) now propagates x’s process flags (environment, flags, working directory, etc) if x is the first interpolant and errors otherwise.
  • Zero-dimensional arrays are now consistently preserved in the return values of mathematical functions that operate on the array(s) as a whole (and are not explicitly broadcasted across their elements). Previously, the functions +, -, *, /, conj, real and imag returned the unwrapped element when operating over zero-dimensional arrays.
  • mod now accepts a unit range as the second argument to easily perform offset modular arithmetic to ensure the result is inside the range.

Julia v1.3 also includes changes in other libraries including Libdl, LinearAlgebra, SparseArrays, Dates, Statistics, Sockets, and a few more. According to the team, @spawn expr from the Distributed standard library should be replaced with @spawnat :any expr. Also, Threads.Mutex and Threads.RecursiveSpinLock have been removed; developers suggest using ReentrantLock (preferred) or Threads.SpinLock instead.

Another tooling improvement includes the ClangSA.jl static analysis package has been imported, which makes use of the clang static analyzer to validate GC invariants in Julia’s C code. The analysis may be run using make -C src analyzegc.

Users are excited to try out Julia v1.3. A user on Hacker News commented, “By far the most interesting part of this release is the new multi-threading features.”

To know more about this news in detail, head over to Julia v1.3 release notes.

2 comments on “Julia v1.3 released with new multithreading highlights, and significantly more!

Leave a Reply

Your email address will not be published. Required fields are marked *