Skip to content

JLArrays 0.4 takes ~4.5 s to load (was 0.5 s), spent activating its methods #807

Closed

Description

@IanButterworth

Claude:


using JLArrays got about 9x slower with JLArrays v0.4.0 / GPUArrays v12.0.0.

Julia 1.13.1, macOS aarch64, fresh process, after precompiling:

JLArrays 0.3.3 + GPUArrays 11.5.16 JLArrays 0.4.0 + GPUArrays 12.0.0
using JLArrays 0.47 to 0.54 s 4.52 to 4.64 s
allocated 52 MiB 1850 MiB
JLArrays precompile 0.8 s 4.8 s
invalidated method instances 198 1842
  • Where: loading SIMD, AcceleratedKernels and GPUArrays first takes 0.07, 0.23 and 0.34 s. The rest is JLArrays' own image: @time_imports gives it 4.4 s with no compilation time.
  • Profile: almost all of that is jl_activate_methods → jl_method_table_activate → type_morespecific_ (subtyping), i.e. inserting JLArrays' methods into the method tables. The new methods in sorting.jl, accumulate.jl and findall.jl (on AnyJLArray) are the likely cause.
  • Invalidations: most of the new ones come from SIMD.jl, newly pulled in via AcceleratedKernels (!=, >=, > in simdvec.jl, about 1400 instances).

Repro:

using Pkg; Pkg.activate(temp=true); Pkg.add(name="JLArrays", version="0.4")
# then in a new process with that environment
@time using JLArrays

It shows up in Julia's TTFX CI: JLArrays/Matrix-Multiplication-On-Gpu-Like-Arrays load went from 0.9 s to 8.4 s on macOS when the job picked up these releases (perf.julialang.org).

Written with Claude Code (Claude Opus 5.5).

Activity

  1. IanButterworth commented on Oct 7, 2026

    @IanButterworth
    Author

    Claude:


    Same on Julia master, and JuliaLang/julia#62658 (fewer recorded backedges) cuts the invalidations but not the load time:

    using JLArrays (3 runs each) allocated invalidated method instances
    nightly 1.14.0-DEV.3529 (beb5136a298) 5.65, 5.66, 5.81 s 1745 MiB 2338
    JuliaLang/julia#62658 (1.14.0-DEV.3517) 5.61, 5.73, 5.79 s 1744 MiB 670

    So the cost is in adding JLArrays' methods to the method tables, not in invalidating code.

    Written with Claude Code (Claude Opus 5.5).

  2. added theissue type on Oct 19, 2026
  3. added
    arraysThe array abstraction: broadcasting, mapreduce, indexing, views, generic linear algebra.
    latencyCompile time, load time, time-to-first-execution, invalidations.
    regressionSomething that used to work, doesn't anymore.
    on Oct 19, 2026
  4. IanButterworth commented on Oct 24, 2026

    @IanButterworth
    Author

    I would say this is fixed on master.... 😂 JuliaLang/julia#64014 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arraysThe array abstraction: broadcasting, mapreduce, indexing, views, generic linear algebra.latencyCompile time, load time, time-to-first-execution, invalidations.regressionSomething that used to work, doesn't anymore.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions