# Julia 1.11 beta high latency

**URL:** <https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819>\
**Category:** Internals & Design\
**Created:** [April 11, 2024, 7:30am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819 "2024-04-11T07:30:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 11, 2024, 7:30am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/1 "2024-04-11T07:30:51Z")

</div>

I had a quick test of the beta today, and found it to be 20% to 70% slower than Julia 1.10. Is this to be expected?

---

<div class="post-metadata">

**Author:** ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Post date:** [April 11, 2024, 7:53am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/2 "2024-04-11T07:53:35Z")

</div>

Given how many other posts I’ve read saying how much faster things are in 1.11 due to the new `Memory` design, I would wager “no, it is not expected”.

Can you perhaps provide some examples, preferably as MWE?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 11, 2024, 8:33am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/3 "2024-04-11T08:33:00Z")

</div>

Installation of the example:

```julia
mkdir perf
cd perf
mkdir data
julia --project="."
using Pkg
pkg"add KiteUtils"
exit()

```

**Julia 1.10.2**  
`julia --project`

First test:

```julia
@time using KiteUtils
  0.646830 seconds (1.46 M allocations: 90.701 MiB, 7.00% gc time, 26.15% compilation time: 78% of which was recompilation)

```

Second test:

```julia
using KiteUtils
KiteUtils.copy_settings()
@time KiteUtils.test(true);
  4.052462 seconds (15.21 M allocations: 1.005 GiB, 11.06% gc time, 99.87% compilation time)

```

**Julia 1.11.0-beta1**

```julia
@time using KiteUtils
  1.091960 seconds (4.58 M allocations: 242.670 MiB, 11.99% gc time, 50.97% compilation time: 79% of which was recompilation)

```

68% slower

```julia
using KiteUtils
KiteUtils.copy_settings()
@time KiteUtils.test(true);
  5.057151 seconds (26.70 M allocations: 1.330 GiB, 4.21% gc time, 99.89% compilation time)

```

24% slower

---

<div class="post-metadata">

**Author:** ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Post date:** [April 11, 2024, 9:01am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/4 "2024-04-11T09:01:36Z")

</div>

It seems like compilation time increased?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [April 11, 2024, 9:16am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/5 "2024-04-11T09:16:25Z")

</div>

Maybe relevant:

> <https://github.com/JuliaLang/julia/issues/53570>
>
> THe compile time is quite variable but the differences are comparable to this.
> …\`\`\`
> | | |\_| | | | (\_| | | Version 1.10.2 (2024-03-01)
> \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | Official https://julialang.org/ release
> |\_\_/ |
> 
> julia\> cd("c:/v"); @time using GMT
> Precompiling GMT
> 1 dependency successfully precompiled in 48 seconds. 87 already precompiled.
> 49.657821 seconds (4.51 M allocations: 328.234 MiB, 0.21% gc time, 1.84% compilation time)
> \`\`\`
> 
> \`\`\`
> | | |\_| | | | (\_| | | Version 1.11.0-alpha1 (2024-03-01)
> \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | Official https://julialang.org/ release
> |\_\_/ |
> 
> julia\> cd("c:/v"); @time using GMT
> Precompiling GMT
> 1 dependency successfully precompiled in 60 seconds. 112 already precompiled.
> 61.731323 seconds (4.22 M allocations: 263.147 MiB, 0.35% gc time, 1.69% compilation time: 15% of which was recompilation)
> \`\`\`
> 
> v1.11 cache file -\> ~89.5 MB
> v1.10 -\> ~59.5 Mb
> 
> Load times
> \`\`\`
> | | |\_| | | | (\_| | | Version 1.10.2 (2024-03-01)
> \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | Official https://julialang.org/ release
> |\_\_/ |
> 
> julia\> @time\_imports using GMT
> ┌ 2.7 ms SuiteSparse\_jll.\_\_init\_\_()
> 25.6 ms SuiteSparse\_jll 85.64% compilation time
> ┌ 5.0 ms SparseArrays.CHOLMOD.\_\_init\_\_() 98.93% compilation time
> 123.1 ms SparseArrays 3.99% compilation time
> 0.7 ms Statistics
> 0.2 ms DataValueInterfaces
> 0.6 ms DataAPI
> 0.2 ms IteratorInterfaceExtensions
> 0.2 ms TableTraits
> 6.3 ms Tables
> 0.2 ms Reexport
> 12.1 ms Preferences
> 0.3 ms PrecompileTools
> 5.7 ms StringManipulation
> 10.3 ms Crayons
> 0.6 ms LaTeXStrings
> 63.7 ms PrettyTables
> ┌ 17.4 ms GMT.Gdal.\_\_init\_\_()
> ├ 16.6 ms GMT.\_\_init\_\_()
> 319.5 ms GMT
> \`\`\`
> 
> \`\`\`
> | | |\_| | | | (\_| | | Version 1.11.0-alpha1 (2024-03-01)
> \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | Official https://julialang.org/ release
> |\_\_/ |
> 
> julia\> @time\_imports using GMT
> 0.7 ms Statistics
> 0.3 ms DataValueInterfaces
> 0.5 ms DataAPI
> 0.2 ms IteratorInterfaceExtensions
> 0.2 ms TableTraits
> 6.8 ms Tables
> 0.4 ms Reexport
> 8.9 ms Preferences
> 0.4 ms PrecompileTools
> 5.8 ms StringManipulation
> 11.7 ms Crayons
> 0.6 ms LaTeXStrings
> 69.4 ms PrettyTables
> ┌ 18.5 ms GMT.Gdal.\_\_init\_\_()
> ├ 108.3 ms GMT.\_\_init\_\_() 88.15% compilation time (100% recompilation)
> 814.4 ms GMT 54.63% compilation time (59% recompilation)
> \`\`\`

---

<div class="post-metadata">

**Author:** ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Post date:** [April 11, 2024, 9:41am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/6 "2024-04-11T09:41:54Z")

</div>

I’m a bit surprised to not see any discussion on the issues.  
Are those problems being tackled?

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [April 11, 2024, 10:09am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/7 "2024-04-11T10:09:28Z")

</div>

It’s on the 1.11 milestone, so it will not be ignored. It has 16 regressions (41% of the 39 open issues on the milestone, though only 8 also marked performance).

In total there are 39 regressions since not all are marked on the milestone.

I wouldn’t worry too much about regressions, this is only a beta, the first one, not even rc1.

I’m though not sure if these are many regression, or unusually many for Julia even. I’m very involved in open source now, at least follow very well what’s happening with JuliaLang, and many packages, but Julia is the first and still only language I’m involved with at that level. I barely follow other language such as Python, so I can’t say if Julia has unusually many regressions. Also Julia is like Python + NumPy at least if you want to compare, but conversely Python has way more in its standard library for non-numerical (not missing for Julia necessarily, just found in packages), so it’s not easy to compare stats of languages.

I think the regressions are a positive, in a sense, since to me it feels like much interesting work is being done, e.g. excellent work on the GC recently. Then you expect some regressions. And it’s not too hard to fix, you just bisect, and you at least have the option to revert the offending change. That’s simple, though you may not want to, and then it may be harder to fix.

Some of the intriguing issues I see looking at the list, note some only marked performance, not regression:

> <https://github.com/JuliaLang/julia/issues/52440>
>
> I have an \`IdDict\` with \`SimpleVector\` keys, I see a lot of time is spent callin…g \`jl\_object\_id\_\` to hash the keys, specifically \[int64hash\](https://github.com/JuliaLang/julia/blob/856e1120a8f255e4907a05f0146a2026a6665dd4/src/support/hashing.c#L28), which is called to hash any 64 bit elements in the key and it's also called in \[bitmix\](https://github.com/JuliaLang/julia/blob/856e1120a8f255e4907a05f0146a2026a6665dd4/src/support/hashing.h#L29). 
> 
> It seems \`jl\_object\_id\_\` is mainly used for hashtables like \`IdDict\` and \`IdSet\` in which case would it be fine to switch to something like \[FxHasher\](https://docs.rs/rustc-hash/latest/rustc\_hash/) (used in the rust compiler) to replace both \`bitmix\` and \`int64hash\`?
> Replacing \`bitmix\` in \`hash\_svec\` with FxHasher gives a 10-100x improvement on \`@benchmark hash(x) setup=x=Core.svec(rand(Int64, 10^n)...)\` for n in 1 to 6.
> 
> However, FxHasher for 64 bit ints is just a multiplication by a constant, though if objectid is only used in internal hashtables, like \`IdDict\`, I think this should be fine. Whilst objectid is used to hash general objects on the Julia side, its passed through a hash so I don't think it should affect \`hash\` in Julia too much.
> 
> Alternatively, we could try using the non AES intrinsic version of ahash, this should still be much faster than what we have currently and higher quality than FxHasher. Again, ahash says it's specifically for hashtables.
> 
> Alternatively, to replace only \`int64hash\`, \[Squirrel3\](https://gist.github.com/Zentrik/b5053668935102719ebf619944ce3e6a) is quite simple and seems to be reasonably fast (about 1.5-2x faster than int64hash) and should have higher quality hashes than FxHasher.
> 
> Does it seem reasonable to make a change along these lines? I see that currently \`int64hash\` is \[invertible\](https://gist.github.com/lh3/974ced188be2f90422cc), do we care about this? I don't see it being used anywhere.
> 
> This would also speed up my robinhood implementation of \`IdDict\`.

> <https://github.com/JuliaLang/julia/issues/53698>
>
> \#52405 bumps LLVM but it seems to have only been a small patch https://github.co…m/JuliaLang/llvm-project/compare/julia-15.0.7-9...julia-15.0.7-10. 
> 
> It caused a 3.5x regression on \`BaseBenchmarks.SUITE\[\["array", "index", ("sumelt\_boundscheck", "BaseBenchmarks.ArrayBenchmarks.ArrayLF{Int32, 2}")\]\]\` which is still present (slightly worse) on master. \[Long run graph\](http://tealquaternion.camdvr.org/graphs.html?start=2023-11-07&benchmark=array.index.%28sumelt\_boundscheck%2C+BaseBenchmarks.ArrayBenchmarks.ArrayLF%7BInt32%2C+2%7D%29&profile=opt&scenario=full&stat=min-wall-time&kind=raw) and the \[Nanosoldier Report\](https://github.com/JuliaCI/NanosoldierReports/blob/master/benchmark/by\_date/2023-12/13/report.md).
> 
> Feel free to close if not an issue.

> <https://github.com/JuliaLang/julia/issues/53786>
>
> The last couple of commits have seen a ~2x regression on NanoSoldier in min wall… time for the string join benchmark, \[graph\](https://tealquaternion.camdvr.org/graphs.html?start=2024-03-01&benchmark=string.join&stat=min-wall-time&kind=raw). Locally, I actually see an improvement, but given the regression has persisted for a few runs I'm inclined to think it's real.

> <https://github.com/JuliaLang/julia/issues/53485>
>
> I think there might be some work left on getting a suitable value for the tuning…\_factor in src/gc.c .
> 
> I bumped it from 2e4 to 2e5 and got more than a 2x reduction in GC times with maximum heap size decreasing as well. This is for append.jl FWIW.
> 
> \- 2e4:
> \`\`\`
> ┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
> │ │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
> │ │ ms │ ms │ ms │ ms │ ms │ us │ MB │ % │
> ├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
> │ minimum │ 952 │ 280 │ 177 │ 103 │ 50 │ 95 │ 3698 │ 29 │
> │ median │ 959 │ 286 │ 177 │ 107 │ 50 │ 101 │ 3700 │ 30 │
> │ maximum │ 964 │ 286 │ 179 │ 108 │ 56 │ 103 │ 4032 │ 30 │
> │ stdev │ 6 │ 3 │ 1 │ 3 │ 4 │ 4 │ 192 │ 0 │
> └─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
> \`\`\`
> 
> \- 2e5:
> \`\`\`
> ┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
> │ │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
> │ │ ms │ ms │ ms │ ms │ ms │ us │ MB │ % │
> ├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
> │ minimum │ 790 │ 116 │ 39 │ 77 │ 40 │ 54 │ 3246 │ 15 │
> │ median │ 799 │ 120 │ 39 │ 81 │ 41 │ 63 │ 3249 │ 15 │
> │ maximum │ 802 │ 126 │ 40 │ 86 │ 50 │ 67 │ 3249 │ 16 │
> │ stdev │ 6 │ 5 │ 1 │ 4 │ 5 │ 7 │ 2 │ 1 │
> └─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
> \`\`\`

> <https://github.com/JuliaLang/julia/issues/52307>
>
> Related to this discourse thread:
> 
> https://discourse.julialang.org/t/trivial-p…ort-from-c-rust-to-julia/105787/46?u=lmiq
> 
> The code posted here runs much faster in 1.9.4 than in 1.10+rc1:
> 
> \`\`\`
> % time julia +1.9 --startup-file=no lv2\_c.jl 0 1000 0.01 200
> typeof(rng) = MarsagliaRng
> Mean IS=0.04462564329047784 OOS=-0.0031496723033457423 Bias=0.047775315593823586
> 11.083806 seconds (169.93 k allocations: 16.234 MiB, 1.22% compilation time)
> 
> real	0m11,553s
> user	0m11,605s
> sys	0m0,318s
> % time julia +1.10 --startup-file=no lv2\_c.jl 0 1000 0.01 200
> typeof(rng) = MarsagliaRng
> Mean IS=0.04462564329047784 OOS=-0.0031496723033457423 Bias=0.047775315593823586
> 42.888539 seconds (168.42 k allocations: 16.271 MiB, 0.38% compilation time)
> 
> real	0m43,412s
> user	0m43,523s
> sys	0m0,291s
> \`\`\`
> 
> The issue is related in how the loop that starts with \`for i in (ilong:ncases-2)\` is lowered. If one adds \`@simd\` to that loop, performance become:
> 
> \`\`\`
> % time julia +1.9 --startup-file=no lv2\_d.jl 0 1000 0.01 200
> typeof(rng) = MarsagliaRng
> Mean IS=0.04462564329047785 OOS=-0.0031496723033457423 Bias=0.04777531559382359
> 4.091737 seconds (179.15 k allocations: 16.861 MiB, 3.62% compilation time)
> 
> real	0m4,544s
> user	0m4,618s
> sys	0m0,314s
> % time julia +1.10 --startup-file=no lv2\_d.jl 0 1000 0.01 200
> typeof(rng) = MarsagliaRng
> Mean IS=0.04462564329047785 OOS=-0.0031496723033457423 Bias=0.04777531559382359
> 3.953665 seconds (177.21 k allocations: 16.855 MiB, 4.40% compilation time)
> 
> real	0m4,380s
> user	0m4,486s
> sys	0m0,297s
> \`\`\`
> 
> \# The code:
> 
> \`\`\`julia
> using Random
> using Printf
> 
> struct ParamsResult
> short\_term::Int
> long\_term::Int
> performance::Float64
> end
> 
> mutable struct MarsagliaRng
> q::Vector{UInt32}
> carry::UInt32
> mwc256\_initialized::Bool
> mwc256\_seed::Int32
> i::UInt8
> 
> function MarsagliaRng(seed::Vector{UInt8})
> q = zeros(UInt32, 256)
> carry = 362436
> mwc256\_initialized = false
> mwc256\_seed = reinterpret(Int32, seed)\[1\]
> i = 255
> new(q, carry, mwc256\_initialized, mwc256\_seed, i)
> end
> end
> 
> \# Default constructor using system time for seeding
> function MarsagliaRng()
> ts\_nano = UInt8(nanosecond(now()))
> seed = \[ts\_nano, ts\_nano \>\>\> 8, ts\_nano \>\>\> 16, ts\_nano \>\>\> 24\]
> MarsagliaRng(seed)
> end
> 
> \# Random number generator functions
> function next\_u32(rng::MarsagliaRng)::UInt32
> a = UInt64(809430660)
> 
> if !rng.mwc256\_initialized
> j = UInt32(rng.mwc256\_seed)
> c1 = UInt32(69069)
> c2 = UInt32(12345)
> rng.mwc256\_initialized = true
> for k in 1:256
> j = (c1 \* j + c2) % UInt32
> rng.q\[k\] = j
> end
> end
> 
> rng.i = (rng.i + 1) % 256
> t = a \* UInt64(rng.q\[rng.i+1\]) + UInt64(rng.carry)
> rng.carry = (t \>\> 32)
> rng.q\[rng.i+1\] = t % UInt32
> 
> return rng.q\[rng.i+1\]
> end
> 
> function next\_u64(rng::MarsagliaRng)::UInt64
> UInt64(next\_u32(rng))
> end
> 
> \# EDIT: extend Base.rand rather than shadowing it.
> \# Sample function for generating a Float64
> function Base.rand(rng::MarsagliaRng)::Float64
> mult = 1.0 / typemax(UInt32)
> mult \* next\_u32(rng)
> end
> 
> 
> function opt\_params(which, ncases::Integer, x::Vector{Float64})
> FloatT = eltype(x)
> xs = cumsum(x)
> best\_perf = typemin(FloatT)
> ibestshort = 0
> ibestlong = 0
> 
> small\_float = 1e-60
> for ilong in 2:199
> for ishort in 1:(ilong-1)
> total\_return = zero(FloatT)
> win\_sum = small\_float
> lose\_sum = small\_float
> sum\_squares = small\_float
> short\_sum = zero(FloatT)
> long\_sum = zero(FloatT)
> 
> 
> let i = ilong - 1
> short\_sum = xs\[i+1\] - xs\[i-ishort + 2 - 1\] 
> long\_sum = xs\[i+1\]
> 
> short\_mean = short\_sum / ishort
> long\_mean = long\_sum / ilong
> 
> ret = (short\_mean \> long\_mean) ? x\[i+2\] - x\[i+1\] :
> (short\_mean \< long\_mean) ? x\[i+1\] - x\[i+2\] : zero(FloatT)
> 
> total\_return += ret
> sum\_squares += ret^2
> if ret \> zero(FloatT)
> win\_sum += ret
> else
> lose\_sum -= ret
> end
> end
> 
> # General case; i != ilong - 1
> # @simd for i in (ilong:ncases-2) # for fast code
> for i in (ilong:ncases-2)
> x1 = x\[i+1\]
> #short\_sum += x1 - x\[i-ishort+1\]
> #long\_sum += x1 - x\[i-ilong+1\]
> 
> short\_sum = xs\[i+1\] - xs\[i-ishort + 1\] 
> long\_sum = xs\[i+1\] - xs\[i-ilong + 1\]
> 
> short\_mean = short\_sum / ishort
> long\_mean = long\_sum / ilong
> 
> ret = (short\_mean \> long\_mean) ? x\[i+2\] - x1 :
> (short\_mean \< long\_mean) ? x1 - x\[i+2\] : zero(FloatT)
> 
> total\_return += ret
> sum\_squares += ret^2
> if ret \> zero(FloatT)
> win\_sum += ret
> else
> lose\_sum -= ret
> end
> end
> 
> if which == 0
> total\_return /= (ncases - ilong)
> if total\_return \> best\_perf
> best\_perf = total\_return
> ibestshort = ishort
> ibestlong = ilong
> end
> elseif which == 1
> pf = win\_sum / lose\_sum
> if pf \> best\_perf
> best\_perf = pf
> ibestshort = ishort
> ibestlong = ilong
> end
> elseif which == 2
> total\_return /= (ncases - ilong)
> sum\_squares /= (ncases - ilong)
> sum\_squares -= total\_return^2
> sr = total\_return / (sqrt(sum\_squares) + 1e-8)
> if sr \> best\_perf
> best\_perf = sr
> ibestshort = ishort
> ibestlong = ilong
> end
> end
> end
> end 
> 
> ParamsResult(ibestshort, ibestlong, best\_perf)
> end
> 
> function test\_system(ncases::Integer, x::Vector{Float64}, short\_term::Integer, long\_term::Integer)
> FloatT = eltype(x)
> sum1 = zero(FloatT)
> 
> for i in (long\_term-1:ncases-2)
> short\_mean = sum(@view x\[i-short\_term+2:i+1\]) / short\_term
> long\_mean = sum(@view x\[i-long\_term+2:i+1\]) / long\_term
> 
> if short\_mean \> long\_mean
> sum1 += x\[i+2\] - x\[i+1\]
> elseif short\_mean \< long\_mean
> sum1 -= x\[i+2\] - x\[i+1\]
> end
> 
> end
> sum1 / (ncases - long\_term)
> end
> 
> function main()
> if length(ARGS) \< 4
> println("Usage: julia script.jl \<which\> \<ncases\> \<trend\> \<nreps\>")
> return
> end
> 
> which = parse(Int, ARGS\[1\])
> ncases = parse(Int, ARGS\[2\])
> save\_trend = parse(Float64, ARGS\[3\])
> nreps = parse(Int, ARGS\[4\])
> 
> optimize(which, ncases, save\_trend, nreps)
> end
> 
> function optimize(which::Integer, ncases::Integer, save\_trend::Float64, nreps::Integer, rng=MarsagliaRng(UInt8.(\[33, 0, 0, 0\])))
> @show typeof(rng)
> \_optimize(rng, which, ncases, save\_trend, nreps)
> end
> 
> function \_optimize(rng, which::Integer, ncases::Integer, save\_trend::Float64, nreps::Integer)
> print\_results = false
> 
> FloatT = typeof(save\_trend)
> x = zeros(FloatT, ncases)
> 
> is\_mean = zero(FloatT)
> oos\_mean = zero(FloatT)
> futures = Task\[\]
> 
> for irep in 1:nreps
> # Generate in-sample
> trend = save\_trend
> x\[1\] = zero(FloatT)
> for i in 2:ncases
> if (i - 1) % 50 == 0
> trend = -trend
> end
> x\[i\] = x\[i-1\] + trend + rand(rng) + rand(rng) - rand(rng) - rand(rng)
> end
> x\_optim = copy(x)
> 
> # Generate out-of-sample
> trend = save\_trend
> x\[1\] = zero(FloatT)
> for i in 2:ncases
> if (i - 1) % 50 == 0
> trend = -trend
> end
> x\[i\] = x\[i-1\] + trend + rand(rng) + rand(rng) - rand(rng) - rand(rng)
> end
> x\_oos = copy(x)
> future = Threads.@spawn begin
> params\_result = opt\_params(which, ncases, x\_optim)
> 
> oos\_perf = test\_system(ncases, x\_oos, params\_result.short\_term, params\_result.long\_term)
> (params\_result, oos\_perf)
> end
> push!(futures, future)
> 
> 
> end
> for (irep, future) in enumerate(futures)
> params\_result::ParamsResult, oos\_perf::Float64 = fetch(future)
> is\_mean += params\_result.performance
> oos\_mean += oos\_perf
> if print\_results
> @printf("%3d: %3d %3d %8.4f %8.4f (%8.4f)\\n",
> irep, params\_result.short\_term, params\_result.long\_term, params\_result.performance, oos\_perf, params\_result.performance - oos\_perf)
> end
> end
> 
> is\_mean /= nreps
> oos\_mean /= nreps
> 
> println("Mean IS=$is\_mean OOS=$oos\_mean Bias=$(is\_mean - oos\_mean)")
> 
> end
> 
> @time main()
> \`\`\`

> <https://github.com/JuliaLang/julia/issues/52137>
>
> Running this piece of code, I get
> 
> \`\`\`julia
> using LinearAlgebra, SparseArrays…, BenchmarkTools
> 
> function \_spmatmul!(C, A, B, α, β)
> size(A, 2) == size(B, 1) || throw(DimensionMismatch())
> size(A, 1) == size(C, 1) || throw(DimensionMismatch())
> size(B, 2) == size(C, 2) || throw(DimensionMismatch())
> nzv = nonzeros(A)
> rv = rowvals(A)
> β != one(β) && LinearAlgebra.\_rmul\_or\_fill!(C, β)
> for k in 1:size(C, 2)
> @inbounds for col in 1:size(A, 2)
> αxj = B\[col,k\] \* α
> for j in nzrange(A, col)
> C\[rv\[j\], k\] += nzv\[j\]\*αxj
> end
> end
> end
> C
> end
> 
> n = 1000;
> A = sparse(Float64, I, n, n);
> b = Vector{Float64}(undef, n);
> x = ones(n);
> @btime \_spmatmul!($b, $A, $x, true, false);
> \# 1.703 μs (0 allocations: 0 bytes) on v1.9.3
> \# 2.161 μs (0 allocations: 0 bytes) on v1.10.0-rc1
> \# 2.945 μs (0 allocations: 0 bytes) on an 11 days old master
> \`\`\`
> 
> Multiplication dispatch has changed over the 1.9 to 1.10 transition, but this is nothing but the barebone mutliplication code that we used to have "ever since", so without character processing and all that. And since this is not calling high-level functions, the issue must be outside of SparseArrays.jl, AFAIU.
> 
> x-ref https://github.com/JuliaSparse/SparseArrays.jl/issues/469

> <https://github.com/JuliaLang/julia/issues/53260>
>
> Basically the title, the reproducer is in a private code base but I'll try to ma…ke an open source MWE.

While I’m here, I’ve been thinking do languages, at least Julia return memory to the OS, and I found my answer, but only for Java:

> **[Does GC Release Back Memory to OS? | Baeldung](https://www.baeldung.com/gc-release-memory)**
>
> Learn how Java Garbage Collection works.

> Some GC implementations actively support heap shrinking. **Heap shrinking is the process of releasing back the excess memory from heap to OS for optimal resource usage.**
> 
> For example, Parallel GC doesn’t release unused memory back to the OS readily. On the other hand, some **GCs analyze the memory consumption and determine accordingly to release some free memory from the heap.** G1, Serial, [Shenandoah, and Z GCs](https://www.baeldung.com/jvm-experimental-garbage-collectors) support heap shrinking.

For those who’ve not seem this/been following AI music generation, or miss out, I felt I had to post this here, since hilarious, and on MIT license, also good vocals. Maybe open an issue, Julia should link this not the license itself? 🙂 Or make a happy version since we like the license. [https://twitter.com/goodside/status/1775713487529922702](https://twitter.com/goodside/status/1775713487529922702)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [April 11, 2024, 10:55am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/8 "2024-04-11T10:55:23Z")

</div>

I have been trying to tell people about this for a while. Julia 1.11 is going to be slower than Julia 1.10 for a number of reasons. There are a lot of big changes landing in this release. Besides the `Memory` change, more packages have been kicked out of the system image.

If you a performance sensitive user, Julia 1.10 might be your version for a while as the ecosystem adapts to these changes.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [April 11, 2024, 10:59am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/9 "2024-04-11T10:59:07Z")

</div>

> [@mkitti](#):
>
> I have been trying to tell people about this for a while. Julia 1.11 is going to be slower than Julia 1.10 for a number of reasons.

OK, comprehensible, but than, sorry, why releasing 1.11 in that state?

---

<div class="post-metadata">

**Author:** ![lassepe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lassepe/32/10050_2.png) [@lassepe](https://discourse.julialang.org/u/lassepe)\
**Post date:** [April 11, 2024, 11:36am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/10 "2024-04-11T11:36:55Z")

</div>

Training of some of my Flux models is also about 20% slower (irrespective of load times or compilation times). I guess this would also be related to the `Memory` change (?)

@mkitti can you share some info on which kind of changes package developers should consider to get back to 1.10 speed?

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [April 11, 2024, 11:43am UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/11 "2024-04-11T11:43:19Z")

</div>

> [@joa-quim](#):
>
> OK, comprehensible, but than, sorry, why releasing 1.11 in that state?

It’s not released yet, and work is underway to address regressions before the actual release. The beta versions are meant for users and package developers to point out issues with the upcoming release. It would actually be good if new regressions or breakages are reported to the issue tracker.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [April 11, 2024, 12:30pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/12 "2024-04-11T12:30:08Z")

</div>

> [@mkitti](#):
>
> have been trying to tell people about this for a while. Julia 1.11 is going to be slower than Julia 1.10

You didn’t quote the full story.

EDIT: Sorry for misunderstanding, this was a reply to the jishnub’s comment above.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [April 11, 2024, 12:59pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/13 "2024-04-11T12:59:51Z")

</div>

Here’s a small part of it:

> [@Should we distribute multiple official system images for Julia 1.11?](https://discourse.julialang.org/t/should-we-distribute-multiple-official-system-images-for-julia-1-11/107353):
>
> In Julia 1.11, REPL.jl and Pkg.jl are now independent packages and not standard in the system image. This will help slim down the system image and make Julia’s packaging more modular. REPL.jl and Pkg.jl will be able to updated independently of a Julia release. I’m also currently investigating how to decouple the two packages by making the Pkg REPL mode a package extension. However, having Pkg.jl and REPL.jl as independent packages will make startup of the interactive Julia experience slower tha…

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [April 11, 2024, 1:12pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/14 "2024-04-11T13:12:29Z")

</div>

Most of the load time regression seems to come from TimeZones:

```julia
julia> @time using TimeZones
  0.096659 seconds (402.11 k allocations: 18.721 MiB, 20.38% compilation time)

julia> VERSION
v"1.10.2"

```

vs

```julia
julia> @time using TimeZones
  0.456108 seconds (3.32 M allocations: 165.423 MiB, 13.80% gc time, 68.63% compilation time: 90% of which was recompilation)

julia> VERSION
v"1.11.0-beta1"

```

Particularly, the compilation of the ` __init__ ` method in the package.

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [April 11, 2024, 1:50pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/15 "2024-04-11T13:50:46Z")

</div>

Maybe 1.11 is in a time zone that’s 0.4 seconds ahead?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [April 11, 2024, 2:10pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/16 "2024-04-11T14:10:31Z")

</div>

Yes, this is precisely why betas are released and is the kind of feedback that’s needed to get to make releases better. If we knew that there weren’t problems/regressions, this would’ve been tagged as a release candidate. The beta simply means that there won’t be net-new features added anymore.

Please don’t feel sheepish about posting regressions in the beta — or, really, ever! Sure, some might already be known, but the more minimal you can make the example the more likely someone might be able to identify that.

Julia v1.11 does incorporate some pretty big changes, so all the more reason to check out the betas! The more folks that do, the better the release will be.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [April 11, 2024, 2:16pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/17 "2024-04-11T14:16:01Z")

</div>

Is @mkitti’s position above the official position of the core devs? I.e. Julia 1.11 would be released despite material performance regression, because the changes introduced warrant this and performance sensitive users shouldn’t upgrade?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [April 11, 2024, 4:36pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/18 "2024-04-11T16:36:33Z")

</div>

9 posts were split to a new topic: [Increase in allocations with Julia v1.11-beta](https://discourse.julialang.org/t/increase-in-allocations-with-julia-v1-11-beta/112838)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [April 11, 2024, 2:20pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/19 "2024-04-11T14:20:58Z")

</div>

> [@joa-quim](#):
>
> OK, comprehensible, but than, sorry, why releasing 1.11 in that state?

Part of it is that a fair amount of work needs to be done on the package side to take advantage of Julia 1.11’s features.

For what I cited above, Pkg.jl needs to be adapted to work well as a regular package outside the system image. One concern that I hope is addressed before release is invalidations of `Base.BinaryPlatforms` method by `Pkg.BinaryPlatforms` that can lead to a fair amount of recompilation when using certain JLLs or artifacts.

For other packages, loading Pkg is no longer relatively free, so some packages that do this may want to consider other routes. `Base` has some rudimentary functionality that could be used instead of `Pkg`. With Julia 1.11, there is a clearer incentive to use those over Pkg APIs for lightweight work. Similar advice goes for other former standard library packages which were in the system image but are no longer there in Julia 1.11.

While some of the changes need to be adapted to, ultimately they should eventually enable everything else to be faster due to the system image being smaller.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [April 11, 2024, 2:28pm UTC](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819/20 "2024-04-11T14:28:54Z")

</div>

I do not speak for the “core devs”, which is a nebulous concept. However, history shows us that performance is not guaranteed to monotically increase over time with each release. We saw some performance regressions in Julia 1.7 and even Julia 1.8 before performance gains were consolidated in Julia 1.9 and Julia 1.10. Sometimes performance needs to get worse before it gets better.

I think Julia 1.10 is a strong candidate for a Long Term Support release. That seems to be the general sentiment as well. This also partly is why a lot of more drastic changes are landing in Julia 1.11 since I think they were deferred until after the LTS candidate.

As Matt says, we should really take advantage of the beta to try to address some performance regresssions. However, I also think some needed improvements might not come until Julia 1.12 or later.

[Next page](https://discourse.julialang.org/t/julia-1-11-beta-high-latency/112819.md?page=2)
