aboutsummaryrefslogtreecommitdiff
path: root/docs/implementation/perf.html
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2023-01-19 20:58:55 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2023-01-19 20:58:55 -0500
commit8396fbed1ac2c0358bb0c0d77d6ebffc8ee4d269 (patch)
treecf82377c473f9e2703b77f7b0d44e8780e02dd7d /docs/implementation/perf.html
parentccaa196d6cfa19b9e7a49b1572f0608bb085c1e8 (diff)
Mention )profile on performance page
Diffstat (limited to 'docs/implementation/perf.html')
-rw-r--r--docs/implementation/perf.html3
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/implementation/perf.html b/docs/implementation/perf.html
index 76241e34..7e9dc1ff 100644
--- a/docs/implementation/perf.html
+++ b/docs/implementation/perf.html
@@ -15,10 +15,11 @@
<p>Currently we aim for high performance on a single CPU core, and are focusing on 64-bit x86 and ARM. CBQN doesn't use additional cores or a GPU for acceleration. The Singeli build does use x86 vector instructions up to AVX2 (2013) if present, and has preliminary support for ARM NEON. Singeli is assumed for the discussion here, and without it there are a few more slow cases, particularly comparisons.</p>
<h2 id="performance-resources"><a class="header" href="#performance-resources">Performance resources</a></h2>
<p>The spotty optimization coverage means that it's more accurate to say CBQN can be fast, not that it will be fast. Have to learn how to use it. Definitely ask on the forum if you're having performance troubles so you can find some tricks to use or request improvements.</p>
-<p>There are two measurement tools in the <a href="../spec/system.html#time">time</a> system values. <code><span class='Function'>•MonoTime</span></code> is a high-precision timer for performance measurements; you can take a time before and after some operation or section of a program and subtract them to get a time in seconds (a profiling tool to do this automatically would be nice, but we don't have one). More convenient for small snippets, <code><span class='Modifier'>•_timed</span></code> returns the time to evaluate <code><span class='Function'>𝔽</span><span class='Value'>𝕩</span></code>, averaging over <code><span class='Value'>𝕨</span></code> runs if given. For two-argument functions you can write <code><span class='Value'>w</span><span class='Modifier2'>⊸</span><span class='Function'>F</span><span class='Modifier'>•_timed</span> <span class='Value'>x</span></code> or <code><span class='Function'>F</span><span class='Modifier'>´•_timed</span> <span class='Value'>w</span><span class='Ligature'>‿</span><span class='Value'>x</span></code>. CBQN also has a <code><span class='Paren'>)</span><span class='Value'>time</span></code> command that prints the time taken by an entire expression, not counting compilation time.</p>
+<p>There are two measurement tools in the <a href="../spec/system.html#time">time</a> system values. <code><span class='Function'>•MonoTime</span></code> is a high-precision timer for performance measurements; you can take a time before and after some operation or section of a program and subtract them to get a time in seconds (a profiling tool to do this automatically would be nice, but we don't have one). More convenient for small snippets, <code><span class='Modifier'>•_timed</span></code> returns the time to evaluate <code><span class='Function'>𝔽</span><span class='Value'>𝕩</span></code>, averaging over <code><span class='Value'>𝕨</span></code> runs if given. For two-argument functions you can write <code><span class='Value'>w</span><span class='Modifier2'>⊸</span><span class='Function'>F</span><span class='Modifier'>•_timed</span> <span class='Value'>x</span></code> or <code><span class='Function'>F</span><span class='Modifier'>´•_timed</span> <span class='Value'>w</span><span class='Ligature'>‿</span><span class='Value'>x</span></code>.</p>
<pre><span class='Number'>100</span> <span class='Function'>+</span><span class='Modifier'>´•_timed</span> <span class='Function'>↕</span><span class='Number'>1e6</span> <span class='Comment'># Time +´ only
</span><span class='Paren'>)</span><span class='Value'>time</span><span class='Head'>:</span><span class='Number'>100</span> <span class='Function'>+</span><span class='Modifier'>´</span><span class='Function'>↕</span><span class='Number'>1e6</span> <span class='Comment'># Time entire expression
</span></pre>
+<p>CBQN also has a <code><span class='Paren'>)</span><span class='Value'>time</span></code> command that prints the time taken by an entire expression, not counting compilation time. And a <code><span class='Paren'>)</span><span class='Value'>profile</span></code> command that samples where time was spent by the line—execution naturally has to be spread over several lines for this to be useful, and should take at least a few milliseconds too.</p>
<p>The <a href="https://mlochbaum.github.io/bencharray/pages/summary.html">bencharray</a> tool has a page showing primitive benchmarks with some explanations.</p>
<h2 id="versus-other-array-languages"><a class="header" href="#versus-other-array-languages">Versus other array languages</a></h2>
<p>Things get hard when you try to put array languages up next to each other. You can get completely different results depending on what sort of problems you want to solve and how you write code, and all those different results are valid. Because people ask for it, I'll try to give some description for the implementations I'm familiar with. I'm of course biased towards the languages I've worked on, Dyalog and BQN; if nothing else, these tend to prioritize just the features I find important! Note also that the situation can change over time; these comments are from 2023.</p>