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 findall on Bool array with predicate #42187

Closed
KristofferC opened this issue Sep 9, 2021 · 0 comments · Fixed by #42202
Closed

Performance regression in findall on Bool array with predicate #42187

KristofferC opened this issue Sep 9, 2021 · 0 comments · Fixed by #42202
Labels
performance Must go faster regression Regression in behavior compared to a previous version

Comments

@KristofferC
Copy link
Member

Repro:

using BenchmarkTools
const y = rand(Bool, 1000)
@btime findall(x -> x > 1, y)

1.6:

julia> @btime findall(x -> x > 1, y)
  300.167 ns (1 allocation: 80 bytes)
Int64[]

1.7:

julia> @btime findall(x -> x > 1, y)
  702.505 ns (6 allocations: 4.50 KiB)
Int64[]

Also, note the increase in allocations

@KristofferC KristofferC added performance Must go faster regression Regression in behavior compared to a previous version labels Sep 9, 2021
jakobnissen added a commit to jakobnissen/julia that referenced this issue Sep 10, 2021
* Take shortcuts if f(::Bool) always returns true or false
* Avoid branching in main loop to please branch predictor
* Switch to indexing-agnostic code
* Fix regression mentioned in JuliaLang#42187
jakobnissen added a commit to jakobnissen/julia that referenced this issue Sep 10, 2021
* Take shortcuts if f(::Bool) always returns true or false
* Avoid branching in main loop to please branch predictor
* Switch to indexing-agnostic code
* Fix regression mentioned in JuliaLang#42187
jakobnissen added a commit to jakobnissen/julia that referenced this issue Sep 12, 2021
* Take shortcuts if f(::Bool) always returns true or false
* Avoid branching in main loop to please branch predictor
* Switch to indexing-agnostic code
* Fix regression mentioned in JuliaLang#42187
jakobnissen added a commit to jakobnissen/julia that referenced this issue Sep 12, 2021
* Take shortcuts if f(::Bool) always returns true or false
* Avoid branching in main loop to please branch predictor
* Switch to indexing-agnostic code
* Fix regression mentioned in JuliaLang#42187
jakobnissen added a commit to jakobnissen/julia that referenced this issue Nov 27, 2021
* Take shortcuts if f(::Bool) always returns true or false
* Avoid branching in main loop to please branch predictor
* Switch to indexing-agnostic code
* Fix regression mentioned in JuliaLang#42187
jakobnissen added a commit to jakobnissen/julia that referenced this issue Dec 26, 2021
* Take shortcuts if f(::Bool) always returns true or false
* Avoid branching in main loop to please branch predictor
* Switch to indexing-agnostic code
* Fix regression mentioned in JuliaLang#42187
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

Successfully merging a pull request may close this issue.

1 participant