Julia 1.11 is slower than 1.10?

we have the same CPU, so why is this time double of mine? do you have startup script?

also are you sure you’re not running rc4? rc4 is stable for me:

akako@frame16 ~> hyperfine --warmup 1 'julia +1.11.0-rc4 --startup-file=no -e "1+1"'
Benchmark 1: julia +1.11.0-rc4 --startup-file=no -e "1+1"
  Time (mean ± σ):      99.7 ms ±   7.9 ms    [User: 64.4 ms, System: 54.6 ms]
  Range (min … max):    89.0 ms … 120.7 ms    29 runs

akako@frame16 ~> hyperfine --warmup 1 'julia +1.11.0 --startup-file=no -e "1+1"'
Benchmark 1: julia +1.11.0 --startup-file=no -e "1+1"
  Time (mean ± σ):     124.9 ms ±  59.2 ms    [User: 309.2 ms, System: 44.7 ms]
  Range (min … max):    80.4 ms … 206.4 ms    14 runs

I am also seeing a huge pre-compilation increase in 1.11 compared to 1.10.

Julia 1.10

julia> using PrettyTables

julia> A = ones(2, 2)
2×2 Matrix{Float64}:
 1.0  1.0
 1.0  1.0

julia> @time pretty_table(A)
┌────────┬────────┐
│ Col. 1 │ Col. 2 │
├────────┼────────┤
│    1.0 │    1.0 │
│    1.0 │    1.0 │
└────────┴────────┘
  0.032161 seconds (42.28 k allocations: 3.059 MiB, 97.47% compilation time)

Julia 1.11

julia> using PrettyTables

julia> A = ones(2, 2)
2×2 Matrix{Float64}:
 1.0  1.0
 1.0  1.0

julia> @time pretty_table(A)
┌────────┬────────┐
│ Col. 1 │ Col. 2 │
├────────┼────────┤
│    1.0 │    1.0 │
│    1.0 │    1.0 │
└────────┴────────┘
  0.125523 seconds (784.80 k allocations: 42.458 MiB, 34.03% gc time, 99.67% compilation time: 78% of which was recompilation)

Any ideas where should I start to look for possible fixes?

2 Likes

Maybe that’s related to the StyledStrings package.

--trace-compile

2 Likes
ufechner@framework:~$ hyperfine --warmup 1 'julia +1.11 --startup-file=no -e "1+1"'
Benchmark 1: julia +1.11 --startup-file=no -e "1+1"
  Time (mean ± σ):     205.9 ms ±   2.8 ms    [User: 719.6 ms, System: 57.0 ms]
  Range (min … max):   201.9 ms … 212.2 ms    14 runs

This is on grid power. If I see it correctly you have a framework16, I have framework14 which does not have the same CPU.

ufechner@framework:~$ julia +1.11
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0 (2024-10-07)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

Thanks!

I opened an issue:

Julia 1.11 is recompiling a lot of functions that it should not. For example, I am using PrecompileTools.jl and a very basic call:

precompile(Tuple{typeof(PrettyTables.pretty_table), Any})

is being recompiled.

1 Like

I’ve hit a bunch of seemingly excessive recompilation in 1.11 too, in one of my packages it takes the load time from ~80ms to ~400ms :fearful:

5 Likes

Good to know that I am not alone :slight_smile: Can you please comment on that issue stating the packages with problems so that we can track the issue?

1 Like

I found a “workaround” (that probably is not good to solve the problem). If I add REPL.jl as dependency of PrettyTables.jl and add using REPL, all the overhead is gone. Can you please test if this works for you too?

2 Likes

The “package” I’m working on is a group of several interdependent development-version packages after large refactors, which makes it a bit hard to use as a MWE :sweat_smile:. I might once they’re released if I can’t fix the latency.

1 Like

Just FWIW, while it takes a bit of effort to reproduce (you’ll need to clone my new monorepo and dev the package + dependencies), here’s the shift I’m seeing and worried by:

~$ julia +1.10 --startup-file=no -q
julia> @time using DataToolkitBase
  0.129546 seconds (206.15 k allocations: 16.930 MiB, 8.77% compilation time)

~$ julia +1.11 --startup-file=no -q
julia> @time using DataToolkitBase
  0.387633 seconds (1.33 M allocations: 68.664 MiB, 2.82% gc time, 63.12% compilation time: 95% of which was recompilation)

~$ julia +nightly --startup-file=no -q
julia> @time using DataToolkitBase
  0.520751 seconds (2.43 M allocations: 127.553 MiB, 5.86% gc time, 73.58% compilation time: 39% of which was recompilation)
4 Likes

Hi @tecosaur !

Can you please do one test? Add REPL.jl as dependency to DataToolkitBase and add using REPL at the beginning of DataToolKitBase.jl. If the amount of recompilation reduces a lot, you are facing the same issue that I am. Otherwise, it is something different.

Sure :slightly_smiling_face:. For this, adding REPL makes no difference. I also see large latency increases with other packages that don’t do anything with display code (e.g. DataDeps, which goes from 0.07s to 0.16s).

I mention this because I think there’s a bit more happening with latency in 1.11/nightly than just what you’ve observed with REPL.

2 Likes

This are the known issues:

https://github.com/JuliaLang/julia/issues?q=is%3Aopen+label%3A%22regression+1.11%22+label%3Acompiler%3Alatency

This link does not work, but if you copy and past the link into the browser it works.

1 Like

Yes! So my problem seems completely unrelated. Anyway, at least I have a good (but bad) workaround: adding REPL until we can figure out how to fix those issues.

2 Likes

Seems to be fixed in 1.11.1 (128 ms) compared to 1.10.5 (160 ms).

5 Likes

What seems really slower for me, also in 1.11.1, is the startup time for the interactive session. I don’t know how to measure it properly: evaluating “exit()” seems to force non-interactive mode even when the -i flag is passed to julia so I can’t use the shell time or hyperfine. But my impression is:

julia +1.10 --startup-file=no: loads basically instantly

julia +1.11 --startup-file=no: takes about 1 second!

julia +1.11.1 --startup-file=no: same as 1.11

Does anyone else see the same thing?

Not here. Try with --trace-compile=stderr.

With 1.11 and 1.11.1 this reports precompile(Tuple{typeof(Base.print), Base.TTY, String}), while 1.10 reports nothing…

2 Likes

What’s the versioninfo()? Probably you want to report an issue.