Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance regression in vcat of heterogeneous AbstractVectors #50854

Open
jishnub opened this issue Aug 9, 2023 · 2 comments
Open

Performance regression in vcat of heterogeneous AbstractVectors #50854

jishnub opened this issue Aug 9, 2023 · 2 comments
Labels
arrays [a, r, r, a, y, s] performance Must go faster regression Regression in behavior compared to a previous version

Comments

@jishnub
Copy link
Contributor

jishnub commented Aug 9, 2023

On v1.9.2, using FillArrays:

julia> @btime vcat($(Zeros(100)), $(ones(1)));
  122.875 ns (4 allocations: 976 bytes)

julia> @btime vcat($(zeros(100)), $(ones(1)));
  83.161 ns (1 allocation: 896 bytes)

On v1.10.0-beta1:

julia> @btime vcat($(Zeros(100)), $(ones(1)));
  1.467 μs (21 allocations: 1.28 KiB)

julia> @btime vcat($(zeros(100)), $(ones(1)));
  97.178 ns (1 allocation: 896 bytes)

julia> versioninfo()
Julia Version 1.10.0-beta1
Commit 6616549950e (2023-07-25 17:43 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, tigerlake)
  Threads: 1 on 8 virtual cores
Environment:
  LD_LIBRARY_PATH = :/usr/lib/x86_64-linux-gnu/gtk-3.0/modules
  JULIA_EDITOR = subl

The performance is similar on the current nightly v"1.11.0-DEV.243"

@jishnub jishnub added performance Must go faster arrays [a, r, r, a, y, s] regression Regression in behavior compared to a previous version labels Aug 9, 2023
@jishnub
Copy link
Contributor Author

jishnub commented Sep 1, 2023

This appers fixed on master:

julia> @btime vcat($(zeros(100)), $(ones(1)));
  123.143 ns (1 allocation: 896 bytes)

julia> @btime vcat($(Zeros(100)), $(ones(1)));
  184.479 ns (1 allocation: 896 bytes)

julia> VERSION
v"1.11.0-DEV.387"

Compared to v1.9.3:

julia> @btime vcat($(zeros(100)), $(ones(1)));
  116.497 ns (1 allocation: 896 bytes)

julia> @btime vcat($(Zeros(100)), $(ones(1)));
  170.280 ns (4 allocations: 976 bytes)

The difference of a few ns is probably noise.

It would be good to isolate the commit and backport it (I'll see if I can find it)

@vtjnash vtjnash closed this as completed Sep 1, 2023
@jishnub
Copy link
Contributor Author

jishnub commented Sep 2, 2023

Bisect suggests that the regression was introduced by 5a922fa, and the fix comes from c8ad552, which bumped SparseArrays.

The commits are:
JuliaSparse/SparseArrays.jl@99c99b4...54f4b39

I wonder if this may be backported to v1.10?

Reopening this as a reminder to backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] performance Must go faster regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

2 participants