diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json
index b3556e7..6597a6d 100644
--- a/dev/.documenter-siteinfo.json
+++ b/dev/.documenter-siteinfo.json
@@ -1 +1 @@
-{"documenter":{"julia_version":"1.10.1","generation_timestamp":"2024-02-26T12:49:54","documenter_version":"1.2.1"}}
\ No newline at end of file
+{"documenter":{"julia_version":"1.10.1","generation_timestamp":"2024-02-28T12:53:11","documenter_version":"1.2.1"}}
\ No newline at end of file
diff --git a/dev/benchmark/1717c9ab.svg b/dev/benchmark/1717c9ab.svg
new file mode 100644
index 0000000..073bdc0
--- /dev/null
+++ b/dev/benchmark/1717c9ab.svg
@@ -0,0 +1,46 @@
+
+
diff --git a/dev/benchmark/b2083a7f.svg b/dev/benchmark/6262d1b8.svg
similarity index 83%
rename from dev/benchmark/b2083a7f.svg
rename to dev/benchmark/6262d1b8.svg
index e4618a4..035c180 100644
--- a/dev/benchmark/b2083a7f.svg
+++ b/dev/benchmark/6262d1b8.svg
@@ -30,16 +30,16 @@
julia> Pkg.status()
Status `~/work/SwapSort.jl/SwapSort.jl/docs/Project.toml`
- [6e4b80f9] BenchmarkTools v1.4.0
+ LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
+Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
julia> Pkg.status()
Status `~/work/SwapSort.jl/SwapSort.jl/docs/Project.toml`
+ [6e4b80f9] BenchmarkTools v1.5.0
[e30172f5] Documenter v1.2.1
[b964fa9f] LaTeXStrings v1.3.1
[91a5bcdd] Plots v1.40.1
[90137ffa] StaticArrays v1.9.3
[518c31a9] SwapSort v1.0.0-DEV `~/work/SwapSort.jl/SwapSort.jl`
- [9a3f8284] Random
The precompilation is very slow since the package reads many json
files and build sorting methods based on them.
julia> @time Pkg.precompile("SwapSort")
2.503307 seconds (1.10 M allocations: 77.507 MiB, 5.61% gc time, 93.23% compilation time)
julia> @time using SwapSort
0.000181 seconds (153 allocations: 14.469 KiB)
When sorting variables of the same type, swapsort
has longer compilation time but from 5x to 100x runtime depending on the sorting size. To save the build time of the doc, this page only contains a simplified benchmark. For the full benchmark, run the script.
using SwapSort, StaticArrays, Plots, BenchmarkTools
+ [9a3f8284] Random
The precompilation is very slow since the package reads many json
files and build sorting methods based on them.
julia> @time Pkg.precompile("SwapSort")
1.582212 seconds (1.10 M allocations: 77.521 MiB, 4.66% gc time, 94.07% compilation time)
julia> @time using SwapSort
0.000117 seconds (153 allocations: 14.469 KiB)
When sorting variables of the same type, swapsort
has longer compilation time but from 5x to 100x runtime depending on the sorting size. To save the build time of the doc, this page only contains a simplified benchmark. For the full benchmark, run the script.
using SwapSort, StaticArrays, Plots, BenchmarkTools
samples = [1,2,4,8,16,32,64]
swapsorttime = zeros(7)
svectortime = zeros(7)
vectortime = zeros(7)
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Ja,Fe,Ma,Ap,My,Ju,Jl,Au,Se,Oc,No,De = rand(64)
64-element Vector{Float64}:
- 0.03690513357923075
- 0.10314538678300744
- 0.20981943988026353
- 0.4170343522069384
- 0.8340315188923318
- 0.05567614645351493
- 0.6666981417583379
- 0.24398298625649517
- 0.29643884902928475
- 0.36335673043290106
+ 0.13149337274461181
+ 0.15022822903065514
+ 0.3466555255310896
+ 0.8254747126978271
+ 0.7868499772461707
+ 0.3884835620347813
+ 0.7125606921940892
+ 0.6682370732651164
+ 0.12437102833521319
+ 0.7742889216772635
⋮
- 0.5790339512248562
- 0.8019549336426676
- 0.5118299985002054
- 0.2857914765173615
- 0.729339285107616
- 0.44594646311695463
- 0.32269515497383083
- 0.4717320647511978
- 0.46897420853064753
swapsorttime[1] = @elapsed swapsort(a)
+ 0.09302758238028641
+ 0.8464347451961607
+ 0.9868445896010382
+ 0.6127381539228343
+ 0.7197211104196284
+ 0.6976228510074353
+ 0.8505858960160484
+ 0.14675642095731445
+ 0.05677050480992418
swapsorttime[1] = @elapsed swapsort(a)
swapsorttime[2] = @elapsed swapsort(a,b)
swapsorttime[3] = @elapsed swapsort(a,b,c,d)
swapsorttime[4] = @elapsed swapsort(a,b,c,d,e,f,g,h)
@@ -55,8 +55,8 @@
vectortime[1] = @elapsed sort!([a])
#= Do the same thing. Lines are hidden=#
-plot(samples, [swapsorttime svectortime vectortime], labels=["swapsort" "SVector" "Vector"])
Replacing @elapsed
with @belapsed
, we get the runtime.
plot(samples, [swapsorttime svectortime vectortime], labels=["swapsort" "SVector" "Vector"])
When sorting across different types, methods based on Tuple
or Vararg
suffer from type inference as different orders have different types. As a result, the compilation time can be a lot longer. In this benchmark, we consider up to 23 variables of different types, including
using Random, SwapSort, Plots, BenchmarkTools, StaticArrays
+plot(samples, [swapsorttime svectortime vectortime], labels=["swapsort" "SVector" "Vector"])
Replacing @elapsed
with @belapsed
, we get the runtime.
plot(samples, [swapsorttime svectortime vectortime], labels=["swapsort" "SVector" "Vector"])
When sorting across different types, methods based on Tuple
or Vararg
suffer from type inference as different orders have different types. As a result, the compilation time can be a lot longer. In this benchmark, we consider up to 23 variables of different types, including
using Random, SwapSort, Plots, BenchmarkTools, StaticArrays
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w = shuffle(
[rand(Int), rand(), π, im, 1//2, BigInt(rand(Int128)), rand(BigFloat),
(1,2), Set([1,2]), Dict(1=>2), rand(2,2), rand(Int, 10), randstring(), 1:10, (a=1,b=2),
- CartesianIndex(1,2), 1=>2, sin, :sin, typeof(sin), SwapSort, nothing, 'a'])
Settings
This document was generated with Documenter.jl version 1.2.1 on Monday 26 February 2024. Using Julia version 1.10.1.