-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Apply InitialOptimizations
more consistently in sorting
#47946
Conversation
@nanosoldier |
Your benchmark job has completed - no performance regressions were detected. A full report can be found here. |
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
Performance now looks equal to 1.8 but allocates 3x more. Is that expected? |
The allocations in julia> list = rand(50_000);
julia> ix = collect(1:length(list));
julia> @benchmark sortperm!(x, $list; alg = InsertionSort, rev = true) setup=(x = copy($ix))
BenchmarkTools.Trial: 5 samples with 1 evaluation.
Range (min … max): 1.068 s … 1.144 s ┊ GC (min … max): 0.00% … 0.00%
Time (median): 1.087 s ┊ GC (median): 0.00%
Time (mean ± σ): 1.091 s ± 30.354 ms ┊ GC (mean ± σ): 0.00% ± 0.00%
▁ ▁ █ ▁
█▁▁█▁▁▁▁▁▁▁▁▁▁█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█ ▁
1.07 s Histogram: frequency by time 1.14 s <
Memory estimate: 48 bytes, allocs estimate: 3. See issue #47949 |
The performance diff across this PR seems reasonable under JuliaCI/BaseBenchmarks.jl#305 as well |
Alright. This should be good to go then? |
#47383 revised how initial optimizations (special cases for
eltype
s that are unions with missing and/or a concreteIEEEFloat
orBool
and very small input) are implemented and dispatched to. I accidentally dropped the initial optimizations in that PR for cases where the user specifiesalg=QuickSort
,alg=MergeSort
, oralg=InsertionSort
. I also dropped those optimizations forpartialsort
andparitalsort!
. Thanks @vtjnash for catching these regressions hereThis PR applies
InitialOptimizations
to achieve better performance and avoid regressions.Also fixes a dispatch bug in
::MissingOptimization
and debugs code that was previously unreachable due to that dispatch bug.