Programming language Julia 1.9 available

The release of the programming language Julia 1.9 has been published, combining such qualities as high performance, support for dynamic typing and built-in tools for parallel programming. The syntax of Julia is close to MATLAB, with some elements borrowed from Ruby and Lisp. The string manipulation method is reminiscent of Perl. The project code is distributed under the MIT license.

Key features of the language:

  • High performance: one of the key goals of the project is to achieve performance close to C programs. The Julia compiler is based on the LLVM project and generates efficient native machine code for many target platforms;
  • Support for various programming paradigms, including elements of object-oriented and functional programming. The standard library provides functions for asynchronous I/O, process management, logging, profiling, and package management, among other things;
  • Dynamic typing: The language does not require explicit definition of types for variables, by analogy with scripting programming languages. Supports interactive mode;
  • Optional ability to explicitly specify types;
  • Syntax that is excellent for numerical calculations, scientific calculations, machine learning systems and data visualization. Support for many numeric data types and tools for parallelizing calculations.
  • Ability to directly call functions from C libraries without additional layers.

Major changes in Julia 1.9:

  • New language features
    • Allow assignments to be made in another module using "setproperty!(::Module, ::Symbol, x)".
    • Multiple assignment not in the final position is allowed. For example, the string "a, b..., c = 1, 2, 3, 4" will be processed as "a = 1; b…, = 2, 3; c = 4". This is handled via Base.split_rest.
    • Single character literals now support the same syntax as string literals; those. the syntax can represent invalid UTF-8 sequences, as allowed by the Char type.
    • Added support for the Unicode 15 specification.
    • Nested combinations of tuples and named tuples of characters can now be used as type parameters.
    • New built-in functions "getglobal(::Module, ::Symbol[, order])" and "setglobal!(::Module, ::Symbol, x[, order])" for reading and writing exclusively to global variables. The getglobal method should now be preferred over the getfield method for accessing global variables.
  • Language changes
    • The "@invoke" macro introduced in version 1.7 is now exported and available for use. Also, it now uses the "Core.Typeof(x)" method rather than "Any" when the type annotation is omitted for the "x" argument. This is necessary so that types passed as arguments are processed correctly.
    • Enabled export of the "invokelatest" function and the "@invokelatest" macro introduced in version 1.7.
  • Compiler/Runtime Improvements
    • Significantly reduced time to first execution (TTFX - Time to first execution). Package precompilation now saves the native code in "pkgimage", which means code generated during precompilation will not need to be recompiled after the package is loaded. The use of pkgimages mode can be disabled with the "--pkgimages=no" option.
    • The known problem of quadratic complexity of type inference has been fixed, and in general the inference uses less memory. Some edge cases with auto-generated long functions (such as ModelingToolkit.jl with partial differential equations and large causal models) compile much faster.
    • Calls with non-type-specific arguments can now be Union-splitting optimized for injection or static resolution, even if there are multiple different types of dispatch candidates. This can improve performance in certain situations where object types are not fully statically resolved, by statically resolving "@nospecialize-d" call sites and avoiding recompilation.
    • All uses of the @pure macro in the Base module have been replaced with Base.@assume_effects.
    • Calls to invoke(f, invokesig, args...) with types less specific than those normally used for f(args...) no longer cause the package to be recompiled.
  • Command line parameter changes
    • On Linux and Windows, the "--threads=auto" option now attempts to determine the available number of processors based on CPU affinity, which is a mask typically set in HPC and cloud environments.
    • The "--math-mode=fast" option has been disabled, instead of which it is recommended to use the "@fastmath" macro, which has well-defined semantics.
    • The "--threads" parameter now has the format "auto | N[,auto|M]", where M specifies the number of interactive threads to create (currently auto means 1).
    • Added option "--heap-size-hint= ”, which sets the threshold after which active garbage collection begins. The size can be specified in bytes, kilobytes (1000 KB), megabytes (300 MB), or gigabytes (1,5 GB).
  • Multithreading Changes
    • "Threads.@spawn" now has an optional first argument of ":default" or ":interactive". An interactive task requires a low latency response and is designed to be short or frequently performed. Interactive tasks will run on interactive threads if they are specified when starting Julia.
    • Threads launched outside the Julia runtime (for example, from C or Java) can now call Julia code using "jl_adopt_thread". This happens automatically when you enter Julia code through "cfunction" or the "@ccallable" entry point. As a consequence, the number of threads can now change at runtime.
  • New library functions
    • New "Iterators.flatmap" function.
    • New "pkgversion(m::Module)" function to get the version of the package that loaded a given module, similar to "pkgdir(m::Module)".
    • New "stack(x)" function that generalizes "reduce(hcat, x::Vector{<:Vector})" to any dimension and allows any iterator of iterators. The "stack(f, x)" method generalizes "mapreduce(f, hcat, x)" and is more efficient.
    • New macro for parsing allocated memory "@allocations", similar to "@allocated", except that it returns the number of memory allocations, not the total size of the allocated memory.
  • New features of the library
    • "RoundFromZero" now works for types other than "BigFloat".
    • "Dict" can now be scaled down manually with "sizehint!".
    • "@time" now separately indicates the percentage of time spent recompiling invalid methods.
  • Changes in the standard library
    • Fixed a concurrency issue in iteration methods for Dict and other derived objects such as keys(::Dict), values(::Dict) and Set. These iteration methods can now be called on a Dict or Set in parallel on an unlimited number of threads, as long as there are no actions that modify the dictionary or set.
    • Negating the predicate function "!f" now returns a composite function "(!) ∘ f" instead of an anonymous function.
    • Dimension slice functions now work across multiple dimensions: "eachslice", "eachrow", and "eachcol" return a "Slices" object that allows dispatching to provide more efficient methods.
    • Added "@kwdef" macro to the public API.
    • Fixed a problem with the order of operations in "fld1".
    • Sorting is now always time-stable (redesigned QuickSort).
    • "Base.splat" is now exported. The return value is of type "Base.Splat" rather than an anonymous function, which allows it to be nicely inferred.
  • Package manager
    • "Package Extensions": support for loading a code snippet from other packages loaded in a Julia session. The application is similar to the "Requires.jl" package, but pre-compilation and configuration compatibility are supported.
  • LinearAlgebra Library
    • Due to the risk of confusion with elementwise division, the "a / b" and "b \ a" methods with scalar "a" and vector "b" were removed, which were equivalent to "a * pinv(b)".
    • BLAS and LAPACK calls now use "libblastrampoline (LBT)". OpenBLAS is supplied by default, but building a system image with other BLAS/LAPACK libraries is not supported. Instead, it is recommended to use the LBT mechanism to replace BLAS/LAPACK with another available set of libraries.
    • "lu" supports the new "RowNonZero()" matrix rotation strategy, which selects the first non-zero rotation element for use with the new arithmetic types and for educational purposes.
    • "normalize(x, p=2)" now supports any normalized vector space "x", including scalars.
    • The default number of BLAS threads is now equal to the number of CPU threads on ARM architecture and half the number of CPU threads on other architectures.
  • Printf: Reworked error messages for malformed strings for better readability.
  • Profile: New "Profile.take_heap_snapshot(file)" function that captures a file in the JSON-based ".heapsnapshot" format supported by Chrome.
  • Random: randn and randexp now work for any AbstractFloat type that defines rand.
  • REPL
    • Pressing the "Alt-e" key combination now opens the current input in the editor. The content (if changed) will be executed when the editor exits.
    • The current module context that is active in the REPL can be changed (by default it is Main) using the "REPL.activate(::Module)" function or by entering the module in the REPL and pressing the "Alt-m" key combination.
    • The "numbered prompt" mode, which prints numbers for each input and output and stores the evaluated results in Out, can be activated with "REPL.numbered_prompt!()".
    • Tab completion displays the available keyword arguments.
  • SuiteSparse: Moved code for "SuiteSparse" solver to "SparseArrays.jl". Solvers are now re-exported by "SuiteSparse.jl".
  • SparseArrays
    • SuiteSparse solvers are now available as submodules of SparseArrays.
    • The UMFPACK and CHOLMOD stream protection modes have been improved by eliminating global variables and using locks. Multithreaded "ldiv!" UMFPACK objects can now be executed safely.
    • The experimental function "SparseArrays.allowscalar(::Bool)" allows you to disable or enable scalar indexing of sparse arrays. This function is designed to detect random scalar indexing of "SparseMatrixCSC" objects, which is a common source of performance problems.
  • New failover mode for test suites that terminates a test run early in the event of a failure or error. Set either via "@testset kwarg failfast=true" or "export JULIA_TEST_FAILFAST=true". This may be necessary in CI launches to receive early error messages.
  • Dates: Empty strings are no longer parsed incorrectly as valid "DateTime", "Dates" or "Times" values ​​and instead throw an "ArgumentError" error in constructors and parsing, while "tryparse" returns nothing.
  • Distributed package
    • The package configuration (active project, "LOAD_PATH", "DEPOT_PATH") is now propagated when local worker processes are added (e.g. with "addprocs(N::Int)" or with the command line flag "-procs=N").
    • "addprocs" for local worker processes now takes an argument named "env" to pass environment variables to worker processes.
  • Unicode: "graphemes(s, m:n)" returns the substring from mth to nth graphemes in "s".
  • The DelimitedFiles package has been removed from the system libraries and is now distributed as a separate package that must be explicitly installed in order to be used.
  • External dependencies
    • Linux automatically detects the version of the system library libstdc++ and loads it if it is newer. The old behavior of loading the built-in libstdc++ regardless of system version can be restored by setting the "JULIA_PROBE_LIBSTDCXX=0" environment variable.
    • Removed "RPATH" from the julia binary, which can break libraries on Linux that fail to define the "RUNPATH" variable.
    • Tool improvements: The output of "MethodError" and methods (for example, from "methods(my_func)") is now formatted and colored according to how methods are output in stack traces.

    Source: opennet.ru

Add a comment