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

order of magnitude type-unstable performance regression #50130

Open
aplavin opened this issue Jun 11, 2023 · 3 comments
Open

order of magnitude type-unstable performance regression #50130

aplavin opened this issue Jun 11, 2023 · 3 comments
Labels
performance Must go faster regression Regression in behavior compared to a previous version

Comments

@aplavin
Copy link
Contributor

aplavin commented Jun 11, 2023

Taking an example from discource,

julia> using BenchmarkTools
julia> x_nan = [([1., 2., 3.],), ([1., 2., 3., NaN],)]
julia> x_missing = [([1., 2., 3.],), ([1., 2., 3., missing],)]
julia> @btime map(x -> sum.(x), $x_nan)
julia> @btime map(x -> sum.(x), $x_missing)

I get:

  • 1.8:
  58.755 ns (1 allocation: 80 bytes)
  808.369 ns (8 allocations: 240 bytes)
  • 1.9 and recent nightly:
  59.531 ns (1 allocation: 80 bytes)
  6.157 μs (16 allocations: 576 bytes)

So, the type-unstable performance suffers a lot, even for a very simple piece of code!

Unlike another 1.9 regression #48612, this one is present even on nightly.

@maleadt
Copy link
Member

maleadt commented Jun 11, 2023

Bisected to #45062; maybe a dup of #49145?

@brenhinkeller brenhinkeller added performance Must go faster regression Regression in behavior compared to a previous version labels Aug 4, 2023
@aplavin
Copy link
Contributor Author

aplavin commented Dec 27, 2023

Same in 1.10.

@aplavin
Copy link
Contributor Author

aplavin commented Jun 20, 2024

Same regression remains in 1.11 and nightly as well – about an order of magnitude slowdown wrt 1.8.

1.8:

  22.693 ns (1 allocation: 80 bytes)  # type stable
  262.298 ns (8 allocations: 240 bytes)  # type unstable

1.9:

  21.773 ns (1 allocation: 80 bytes)
  2.301 μs (16 allocations: 576 bytes)

1.10:

  20.520 ns (1 allocation: 80 bytes)
  2.449 μs (16 allocations: 576 bytes)

1.11:

  15.698 ns (2 allocations: 80 bytes)
  2.847 μs (22 allocations: 752 bytes)

nightly:

  15.907 ns (2 allocations: 80 bytes)
  2.819 μs (22 allocations: 752 bytes)

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

No branches or pull requests

3 participants