Skip to content

Regression in recompilation #997

@lxvm

Description

@lxvm

Hi,

I was benchmarking some functions and noticed that loading Revise is leading to unnecessary recompilation of functions on v3.13.1 and Julia v1.12.4 using the following benchmark:

using Revise
function bcastbench!(a, b, c)
    broadcast!(*, a, b, c)
    return a
end
nbase = 2^24
nbatch = 12
a1 = Array{ComplexF64}(undef, nbase, nbatch)
b1 = rand(ComplexF64, nbase, nbatch)
c1 = rand(ComplexF64, nbase, nbatch)

bcastbench!(a1, b1, c1); # first run for compilation
@time bcastbench!(a1, b1, c1);
@time bcastbench!(a1, b1, c1);
@time bcastbench!(a1, b1, c1);

The timed runs shouldn't have to compile bcastbench!, however they do in Julia v1.12.4 with Revise loaded as shown in the results here:

$ julia +lts --startup-file=no bcastbench.jl # v1.10.10 with Revise v3.13.1 unaffected
  0.479097 seconds
  0.482854 seconds
  0.482950 seconds
$ julia +release --startup-file=no bcastbench.jl # v1.12.4 with Revise v3.13.1 regression
  0.740573 seconds (1.08 M allocations: 58.439 MiB, 91.25% compilation time)
  0.785327 seconds (1.19 M allocations: 58.842 MiB, 96.01% compilation time)
  0.839740 seconds (1.27 M allocations: 62.654 MiB, 102.61% compilation time)

The slowdown is confusing for benchmarks, but only a minor inconvenience on my Debian machine. However, on my M3 Macbook, the recompilation takes longer and longer on each trial and takes an increasing amount of memory and time (several Gigabytes and a minute to run by the third trial) to the point it necessitates a change in workflow.

Why would Revise be recompiling unnecessarily? This appears to be a regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions