-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
performanceMust go fasterMust go fasterregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous versionsortingPut things in orderPut things in order
Description
Related to this discourse thread: https://discourse.julialang.org/t/in-place-sorting-for-views/56194
using BenchmarkTools
using StableRNGs
rng = StableRNG(2021);
v = rand(rng, 1000);
v2 = rand(rng, 2000);
v2[500:1499] .= v;In Julia 1.7.0-DEV
julia> @btime sort!(vv) setup = (vv = deepcopy($v)) evals = 1;
12.844 μs (0 allocations: 0 bytes)
julia> @btime sort!(vv) setup = (vv1 = deepcopy($v2); vv = @view vv1[500:1499]) evals = 1;
23.333 μs (0 allocations: 0 bytes)
julia> versioninfo()
Julia Version 1.7.0-DEV.538
Commit 85354cf8ef (2021-02-15 11:47 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 4In julia 1.5.3
julia> @btime sort!(vv) setup = (vv = deepcopy($v)) evals = 1;
16.985 μs (0 allocations: 0 bytes)
julia> @btime sort!(vv) setup = (vv1 = deepcopy($v2); vv = @view vv1[500:1499]) evals = 1;
11.745 μs (0 allocations: 0 bytes)
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 4Julia 1.4.1
julia> @btime sort!(vv) setup = (vv = deepcopy($v)) evals = 1;
15.678 μs (0 allocations: 0 bytes)
julia> @btime sort!(vv) setup = (vv1 = deepcopy($v2); vv = @view vv1[500:1499]) evals = 1;
13.833 μs (0 allocations: 0 bytes)
julia> versioninfo()
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 4As mentioned in discourse topic, if I create custom type, and add @inbounds to setindex/getindex, then timings became the same. Just a guess, but can it be related to #39308?
Metadata
Metadata
Assignees
Labels
performanceMust go fasterMust go fasterregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous versionsortingPut things in orderPut things in order