Skip to content

Commit

Permalink
build based on 303c378
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Nov 14, 2024
1 parent ffefbbb commit 8b8f04a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.6","generation_timestamp":"2024-11-14T15:18:44","documenter_version":"1.8.0"}}
{"documenter":{"julia_version":"1.10.6","generation_timestamp":"2024-11-14T15:35:00","documenter_version":"1.8.0"}}
28 changes: 14 additions & 14 deletions dev/benchmark/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
[518c31a9] SwapSort v1.0.1 `~/work/SwapSort.jl/SwapSort.jl`
[36e64239] Unroll v0.1.0
[9a3f8284] Random
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`</code></pre><h2 id="Package-loading"><a class="docs-heading-anchor" href="#Package-loading">Package loading</a><a id="Package-loading-1"></a><a class="docs-heading-anchor-permalink" href="#Package-loading" title="Permalink"></a></h2><p>The precompilation is very slow since the package reads many <code>json</code> files and generate sorting methods based on them. The current bottleneck is <code>JSON.parsefile</code>. A specialized reading method could make great improvement on precompilation speed.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia&gt; @time include(&quot;../../src/SwapSort.jl&quot;)</code><code class="nohighlight hljs ansi" style="display:block;"> 14.794948 seconds (3.27 M allocations: 173.735 MiB, 0.81% gc time, 2.23% compilation time)
Main.SwapSort</code></pre><h2 id="Same-type-(type-stable)"><a class="docs-heading-anchor" href="#Same-type-(type-stable)">Same type (type-stable)</a><a id="Same-type-(type-stable)-1"></a><a class="docs-heading-anchor-permalink" href="#Same-type-(type-stable)" title="Permalink"></a></h2><p>When sorting variables of the same type, <code>swapsort</code> has longer compilation time but from .01x to .2x runtime depending on the sorting size. </p><p>We first generate 64 random variables:</p><pre><code class="language-julia hljs">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)</code></pre><p>Then we sort <span>$N$</span> of them, where <span>$N=1,...,64$</span>. To save the build time of the doc, this section only benchmarks <span>$N=1,2,4,8,16,32,64$</span>. 3 sorting routines are benchmarked:</p><ul><li>SwapSort: use <code>SwapSort.swapsort</code> to sort variables. Returns a sorted <code>Tuple</code>.</li><li>StaticArrays: use <code>StaticArrays.SVector</code> to pack the variables and then sort the <code>SVector</code>. StaticArrays.jl has a built-in bitonic sort for the purpose. Returns a sorted <code>SVector</code> which has a field of sorted <code>NTuple</code>.</li><li>Base: pack the variables into a <code>Vector</code> and use <code>Base.sort!</code>. Returns a sorted <code>Vector</code>.</li></ul><p>The full benchmark can run from <a href="https://github.com/putianyi889/SwapSort.jl/blob/master/scripts/bench_var_sorting.jl">this script</a>. We use <code>@elapsed</code> to get the first-time sort which is mostly compilation time. Then we use <code>BenchmarkTools.@belapsed</code> to get the actual runtime.</p><h3 id="Compilation"><a class="docs-heading-anchor" href="#Compilation">Compilation</a><a id="Compilation-1"></a><a class="docs-heading-anchor-permalink" href="#Compilation" title="Permalink"></a></h3><div id='RIqggIynsi' class='' style=';'></div>
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`</code></pre><h2 id="Package-loading"><a class="docs-heading-anchor" href="#Package-loading">Package loading</a><a id="Package-loading-1"></a><a class="docs-heading-anchor-permalink" href="#Package-loading" title="Permalink"></a></h2><p>The precompilation is very slow since the package reads many <code>json</code> files and generate sorting methods based on them. The current bottleneck is <code>JSON.parsefile</code>. A specialized reading method could make great improvement on precompilation speed.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia&gt; @time include(&quot;../../src/SwapSort.jl&quot;)</code><code class="nohighlight hljs ansi" style="display:block;"> 15.000000 seconds (3.29 M allocations: 174.441 MiB, 0.82% gc time, 2.22% compilation time)
Main.SwapSort</code></pre><h2 id="Same-type-(type-stable)"><a class="docs-heading-anchor" href="#Same-type-(type-stable)">Same type (type-stable)</a><a id="Same-type-(type-stable)-1"></a><a class="docs-heading-anchor-permalink" href="#Same-type-(type-stable)" title="Permalink"></a></h2><p>When sorting variables of the same type, <code>swapsort</code> has longer compilation time but from .01x to .2x runtime depending on the sorting size. </p><p>We first generate 64 random variables:</p><pre><code class="language-julia hljs">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)</code></pre><p>Then we sort <span>$N$</span> of them, where <span>$N=1,...,64$</span>. To save the build time of the doc, this section only benchmarks <span>$N=1,2,4,8,16,32,64$</span>. 3 sorting routines are benchmarked:</p><ul><li>SwapSort: use <code>SwapSort.swapsort</code> to sort variables. Returns a sorted <code>Tuple</code>.</li><li>StaticArrays: use <code>StaticArrays.SVector</code> to pack the variables and then sort the <code>SVector</code>. StaticArrays.jl has a built-in bitonic sort for the purpose. Returns a sorted <code>SVector</code> which has a field of sorted <code>NTuple</code>.</li><li>Base: pack the variables into a <code>Vector</code> and use <code>Base.sort!</code>. Returns a sorted <code>Vector</code>.</li></ul><p>The full benchmark can run from <a href="https://github.com/putianyi889/SwapSort.jl/blob/master/scripts/bench_var_sorting.jl">this script</a>. We use <code>@elapsed</code> to get the first-time sort which is mostly compilation time. Then we use <code>BenchmarkTools.@belapsed</code> to get the actual runtime.</p><h3 id="Compilation"><a class="docs-heading-anchor" href="#Compilation">Compilation</a><a id="Compilation-1"></a><a class="docs-heading-anchor-permalink" href="#Compilation" title="Permalink"></a></h3><div id='jgSmmrlM0C' class='' style=';'></div>
<script type="module">
import Plotly from "https://esm.sh/[email protected]"
const PLOT = document.getElementById("RIqggIynsi")
const plot_obj = {"data": [{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[0.002510844,0.00540426,0.009525066,0.027093777,0.078578581,0.282298199,1.033980185],"name":"SwapSort"},{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[0.087199783,0.245408329,0.020609382,0.054853207,0.159125585,0.204677834,0.182377357],"name":"StaticArrays"},{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[1.201721321,5.25e-6,5.841e-6,5.34e-6,6.803e-6,6.282e-6,1.0059e-5],"name":"Base"}], "layout": {"xaxis":{"type":"log","dtick":0.3010299956639812,"title":"N"},"yaxis":{"type":"log","dtick":1,"exponentformat":"power","title":"Compilation"}}, "config": {"responsive":true}}
const PLOT = document.getElementById("jgSmmrlM0C")
const plot_obj = {"data": [{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[0.002495415,0.005215681,0.009570079,0.026636502,0.079781005,0.386237804,1.02653905],"name":"SwapSort"},{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[0.081663161,0.206824454,0.02034794,0.05438665,0.155020014,0.209337372,0.179344001],"name":"StaticArrays"},{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[1.1041655,5.51e-6,4.658e-6,4.118e-6,4.629e-6,4.598e-6,7.544e-6],"name":"Base"}], "layout": {"xaxis":{"type":"log","dtick":0.3010299956639812,"title":"N"},"yaxis":{"type":"log","dtick":1,"exponentformat":"power","title":"Compilation"}}, "config": {"responsive":true}}
Plotly.newPlot(PLOT, plot_obj)

// If width is not specified, set it to 100%
Expand All @@ -33,11 +33,11 @@
// For the height we have to also put a fixed value in case the plot is put on a non-fixed-size container (like the default wrapper)
PLOT.style.height = plot_obj.layout.height ? "" : "100%"
</script>
<h3 id="Runtime"><a class="docs-heading-anchor" href="#Runtime">Runtime</a><a id="Runtime-1"></a><a class="docs-heading-anchor-permalink" href="#Runtime" title="Permalink"></a></h3><div id='5vGOChYqhx' class='' style=';'></div>
<h3 id="Runtime"><a class="docs-heading-anchor" href="#Runtime">Runtime</a><a id="Runtime-1"></a><a class="docs-heading-anchor-permalink" href="#Runtime" title="Permalink"></a></h3><div id='Rof4xnWrjC' class='' style=';'></div>
<script type="module">
import Plotly from "https://esm.sh/[email protected]"
const PLOT = document.getElementById("5vGOChYqhx")
const plot_obj = {"data": [{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[2.785e-9,2.1433299899699097e-8,2.6152610441767066e-8,4.717307692307692e-8,1.2645642701525053e-7,4.561776649746193e-7,1.3935999999999999e-6],"name":"SwapSort"},{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[2.4902659574468086e-7,6.912905405405405e-7,8.548225806451613e-7,9.545555555555555e-7,1.2403e-6,1.7773e-6,3.0595e-6],"name":"StaticArrays"},{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[8.763475546305931e-8,1.015404255319149e-7,1.3993309859154928e-7,1.9149056603773584e-7,3.479769585253456e-7,6.315838150289018e-7,1.3875999999999999e-6],"name":"Base"}], "layout": {"xaxis":{"type":"log","dtick":0.3010299956639812,"title":"N"},"yaxis":{"type":"log","dtick":1,"exponentformat":"power","title":"Runtime"}}, "config": {"responsive":true}}
const PLOT = document.getElementById("Rof4xnWrjC")
const plot_obj = {"data": [{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[3.085e-9,2.0117352056168505e-8,2.6290452261306535e-8,4.7162955465587044e-8,1.1532970620239391e-7,4.4897474747474745e-7,1.4537e-6],"name":"SwapSort"},{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[1.971866883116883e-7,7.505819672131148e-7,8.19722891566265e-7,8.872916666666666e-7,1.2453e-6,1.8305e-6,3.00175e-6],"name":"StaticArrays"},{"type":"scatter","x":[1,2,4,8,16,32,64],"y":[8.756979166666666e-8,1.0447491995731056e-7,1.4584323040380046e-7,1.869001512859304e-7,3.5735071090047394e-7,6.447573964497042e-7,1.4627e-6],"name":"Base"}], "layout": {"xaxis":{"type":"log","dtick":0.3010299956639812,"title":"N"},"yaxis":{"type":"log","dtick":1,"exponentformat":"power","title":"Runtime"}}, "config": {"responsive":true}}
Plotly.newPlot(PLOT, plot_obj)

// If width is not specified, set it to 100%
Expand All @@ -50,11 +50,11 @@ <h2 id="Different-types-(type-unstable)"><a class="docs-heading-anchor" href="#D
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=&gt;2), rand(2,2), rand(Int, 10), randstring(), 1:10, (a=1,b=2),
CartesianIndex(1,2), 1=&gt;2, sin, :sin, typeof(sin), SwapSort, nothing, &#39;a&#39;])</code></pre><h3 id="Compilation-2"><a class="docs-heading-anchor" href="#Compilation-2">Compilation</a><a class="docs-heading-anchor-permalink" href="#Compilation-2" title="Permalink"></a></h3><div id='xDsAALVPc4' class='' style=';'></div>
CartesianIndex(1,2), 1=&gt;2, sin, :sin, typeof(sin), SwapSort, nothing, &#39;a&#39;])</code></pre><h3 id="Compilation-2"><a class="docs-heading-anchor" href="#Compilation-2">Compilation</a><a class="docs-heading-anchor-permalink" href="#Compilation-2" title="Permalink"></a></h3><div id='ZXUyFxKKPI' class='' style=';'></div>
<script type="module">
import Plotly from "https://esm.sh/[email protected]"
const PLOT = document.getElementById("xDsAALVPc4")
const plot_obj = {"data": [{"type":"scatter","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"y":[0.005356728,0.005676084,0.014100266,0.017511403,0.035615953,0.040366109,0.050501746,0.065928669,0.077805325,0.093283483,0.110551722,0.082588382,0.133561498,0.113820373,0.180226122,0.152207509,0.180316631,0.152608075,0.199376123,0.241537813,0.190329659,0.236299777,0.231001288],"name":"SwapSort"},{"type":"scatter","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"y":[0.136724801,0.147032541,0.132387346,0.01520559,0.023484682,0.023844663,0.019117571,0.020515399,0.022158145,0.013452999,0.016824521,0.02004393,0.052258314,0.038042472,0.010129776,0.013204435,0.024652611,0.011183383,0.013777063,0.013735366,0.013010703,0.061344302,0.020555114],"name":"Base"}], "layout": {"yaxis":{"type":"log","dtick":1,"exponentformat":"power","title":"Compilation"},"xaxis":{"dtick":1,"title":"N"}}, "config": {"responsive":true}}
const PLOT = document.getElementById("ZXUyFxKKPI")
const plot_obj = {"data": [{"type":"scatter","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"y":[0.005314662,0.00676098,0.004957112,0.004792524,0.006778162,0.038539165,0.063227064,0.061124106,0.099532485,0.099341989,0.081447211,0.110328081,0.130237873,0.135737531,0.164593163,0.164465193,0.156720722,0.167910044,0.199160732,0.197294467,0.207899835,0.229488832,0.205299657],"name":"SwapSort"},{"type":"scatter","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"y":[0.035735917,0.011541331,0.123564115,0.008219331,0.007886648,0.022737536,0.00775453,0.017271421,0.014799823,0.012132669,0.011301393,0.010763115,0.010723179,0.040597489,0.017526889,0.015644805,0.03589285,0.01388515,0.061931408,0.06661093,0.011106527,0.035761233,0.04245635],"name":"Base"}], "layout": {"yaxis":{"type":"log","dtick":1,"exponentformat":"power","title":"Compilation"},"xaxis":{"dtick":1,"title":"N"}}, "config": {"responsive":true}}
Plotly.newPlot(PLOT, plot_obj)

// If width is not specified, set it to 100%
Expand All @@ -63,11 +63,11 @@ <h2 id="Different-types-(type-unstable)"><a class="docs-heading-anchor" href="#D
// For the height we have to also put a fixed value in case the plot is put on a non-fixed-size container (like the default wrapper)
PLOT.style.height = plot_obj.layout.height ? "" : "100%"
</script>
<h3 id="Runtime-2"><a class="docs-heading-anchor" href="#Runtime-2">Runtime</a><a class="docs-heading-anchor-permalink" href="#Runtime-2" title="Permalink"></a></h3><div id='kDgov3Prqf' class='' style=';'></div>
<h3 id="Runtime-2"><a class="docs-heading-anchor" href="#Runtime-2">Runtime</a><a class="docs-heading-anchor-permalink" href="#Runtime-2" title="Permalink"></a></h3><div id='aWhQzGFRg3' class='' style=';'></div>
<script type="module">
import Plotly from "https://esm.sh/[email protected]"
const PLOT = document.getElementById("kDgov3Prqf")
const plot_obj = {"data": [{"type":"scatter","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"y":[2.785e-9,5.2674442190669374e-8,6.586312563840654e-8,1.1289250814332247e-7,7.356220472440945e-7,9.747647058823529e-7,1.2312e-6,1.3014000000000002e-6,2.1974444444444443e-6,1.9426e-6,2.5547777777777777e-6,2.5168888888888886e-6,4.6987142857142856e-6,3.931125e-6,5.153e-6,4.575714285714285e-6,7.0152e-6,6.209399999999999e-6,8.566e-6,7.892e-6,7.5015e-6,1.0099e-5,9.988e-6],"name":"SwapSort"},{"type":"scatter","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"y":[5.263286004056795e-8,9.356785714285714e-7,1.0239e-6,1.9697e-6,4.598571428571428e-6,5.976166666666667e-6,6.6184e-6,8.0225e-6,9.067e-6,9.768e-6,1.0901e-5,1.2593e-5,1.6431e-5,1.9086e-5,2.0328e-5,2.1761e-5,2.4777e-5,2.7471e-5,2.9184e-5,3.0647e-5,3.2932e-5,2.9776e-5,3.1419e-5],"name":"Base"}], "layout": {"yaxis":{"type":"log","dtick":1,"exponentformat":"power","title":"Runtime"},"xaxis":{"dtick":1,"title":"N"}}, "config": {"responsive":true}}
const PLOT = document.getElementById("aWhQzGFRg3")
const plot_obj = {"data": [{"type":"scatter","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"y":[3.085e-9,2.104212637913741e-8,2.290461847389558e-8,2.4171686746987952e-8,2.571987951807229e-8,2.934436090225564e-7,3.609665071770335e-7,5.366315789473684e-7,8.144302325581395e-7,1.0148e-6,1.5359000000000002e-6,1.4435999999999998e-6,1.8304e-6,1.9355999999999997e-6,3.8885e-6,3.850875e-6,3.323625e-6,4.657285714285714e-6,8.202333333333334e-6,7.04825e-6,7.5165e-6,8.726333333333333e-6,8.813e-6],"name":"SwapSort"},{"type":"scatter","x":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],"y":[5.107801418439716e-8,6.143107344632768e-7,1.0349e-6,1.7302e-6,2.142888888888889e-6,3.14975e-6,3.773375e-6,4.268e-6,5.578666666666667e-6,6.46e-6,7.86475e-6,8.896666666666666e-6,9.538e-6,1.3636e-5,1.565e-5,1.6541e-5,1.8544e-5,2.0137e-5,2.7902e-5,3.2762e-5,3.4806e-5,3.2882e-5,4.9022e-5],"name":"Base"}], "layout": {"yaxis":{"type":"log","dtick":1,"exponentformat":"power","title":"Runtime"},"xaxis":{"dtick":1,"title":"N"}}, "config": {"responsive":true}}
Plotly.newPlot(PLOT, plot_obj)

// If width is not specified, set it to 100%
Expand All @@ -76,4 +76,4 @@ <h3 id="Runtime-2"><a class="docs-heading-anchor" href="#Runtime-2">Runtime</a><
// For the height we have to also put a fixed value in case the plot is put on a non-fixed-size container (like the default wrapper)
PLOT.style.height = plot_obj.layout.height ? "" : "100%"
</script>
</article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« SwapSort.jl</a><a class="docs-footer-nextpage" href="../docstrings/">Docstrings »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Thursday 14 November 2024 15:18">Thursday 14 November 2024</span>. Using Julia version 1.10.6.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
</article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« SwapSort.jl</a><a class="docs-footer-nextpage" href="../docstrings/">Docstrings »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Thursday 14 November 2024 15:35">Thursday 14 November 2024</span>. Using Julia version 1.10.6.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 8b8f04a

Please sign in to comment.