{"id":5013,"date":"2018-06-11T12:21:21","date_gmt":"2018-06-11T12:21:21","guid":{"rendered":"https:\/\/www.dyalog.com\/blog\/?p=5013"},"modified":"2018-06-12T08:42:05","modified_gmt":"2018-06-12T08:42:05","slug":"expanding-bits-in-shrinking-time","status":"publish","type":"post","link":"https:\/\/www.dyalog.com\/blog\/2018\/06\/expanding-bits-in-shrinking-time\/","title":{"rendered":"Expanding Bits in Shrinking Time"},"content":{"rendered":"<p><a href=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5045\" src=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf0.png\" alt=\"perf0\" width=\"800\" height=\"574\" srcset=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf0.png 800w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf0-300x215.png 300w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf0-418x300.png 418w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><br \/>\nThe chart above compares the performance of <code class=\"language-apl\">\u2218.\u2227<\/code> in Dyalog versions 16.0 and 17.0. The improvement is a factor of 3-4 across the whole range (except at multiple-of-8 lengths, where 16.0 spikes up). That&#8217;s not easy to get, especially for a function like <code class=\"language-apl\">\u2218.\u2227<\/code> which was already the target of a fair amount of special code. And the improvements are completely general. They apply to any scalar dyadic which has a Boolean result on Booleans, which is all but <code class=\"language-apl\">+-\u25cb<\/code>.<\/p>\n<p>How did it happen? The answer, at least for the parts of the graph left of 1024, follows. It takes us through a surprising number of APL primitives, which I think is a great demonstration of the ways APL thinking can lead to faster algorithms even in other languages.<\/p>\n<h2>Binary choices<\/h2>\n<p>One of the many performance bumps in Dyalog version 17 is that selecting from an array of two options using a Boolean array is much faster. Dyalog 17 also takes advantage of this speed improvement by using it for a few other functions: scalar dyadics when one argument is a singleton and the other is Boolean, <code class=\"language-apl\">\u2373<\/code> (or <code class=\"language-apl\">\u220a<\/code>) where the right (left) argument is Boolean, and outer products where the left argument is Boolean.<\/p>\n<p>Selection has been sped up for all kinds of indexed array, but the most interesting case is that in which the cells of the indexed array are Boolean, with a cell shape that&#8217;s not a multiple of 8 (when working with Boolean algorithms, we tend to call such shapes &#8220;odd&#8221;). In this case the rows of the result aren&#8217;t byte-aligned, so to generate them quickly we will need some Boolean trickery. As it turns out, a lot of Boolean trickery.<\/p>\n<p>The centre of our attention will be the function Replicate (<code class=\"language-apl\">\/<\/code>) when the right argument is Boolean and the left is a scalar. That means something like <code class=\"language-apl\">3\/1 0 0 1 0<\/code>. Replicate doesn&#8217;t seem obviously connected to indexing, but like indexing, it turns each bit of the argument into multiple bits in the result. In fact, this is by far the most important and difficult step in implementing Index, since Index may be phrased straightforwardly in terms of Replicate using exclusive or (<code class=\"language-apl\">\u2260<\/code>):<\/p>\n<pre><code class=\"language-apl\">      y[x;]  \u2190\u2192  (((\u2262y)\/\u236ax) \u2227\u23641 \u2260\u233fy) \u2260\u23641 \u22a3\u233fy<\/code><\/pre>\n<p>If for some reason that doesn&#8217;t look straightforward to you, I&#8217;ll explain how it all fits together later. But first, Replicate!<\/p>\n<h2>The trouble with Replicate<\/h2>\n<p>Just implementing Replicate on a Boolean array isn&#8217;t difficult. Read one bit at a time from the argument, and then write it to the result the required number of times. However, reading and writing one bit at a time is <strong>slow<\/strong>. A fast algorithm for Replicate will work an entire machine word at a time (that is, 64 bits on 64-bit systems).<\/p>\n<p>But even fairly well-implemented word-at-a-time strategies will quickly run into another problem: <a href=\"https:\/\/en.wikipedia.org\/wiki\/Branch_predictor\" target=\"_blank\" rel=\"noopener\">branching<\/a>. A simple if\/then construct in C can be very cheap or very expensive depending on whether the CPU is able to predict in advance which path will be taken. With odd-sized replicates the not-quite-periodic way that the writes interact with byte boundaries will make nearly all useful branching unpredictable. But there are many techniques which can allow the CPU to make choices without having to change the path it takes through a program. Coming up is one rather exotic entry in the field of branchless programming.<\/p>\n<h2>Small expansion factors<\/h2>\n<p>When beginning work on fixed-size replicates, I quickly found that, in Dyalog version 16, it was much faster to add a length-1 axis before the first, replicate that, and transpose it to the end than to replicate the last axis directly.<\/p>\n<pre><code class=\"language-apl\">      \u2395IO\u21900 \u22c4 x\u2190?1e4\u23742\r\n      cmpx '5\/\u236ax' 'x,,\u2368,[0.5]\u2368x' '\u23495\u233f(1,\u2374x)\u2374x'\r\n  5\/\u236ax         \u2192 9.5E\u00af5 |   0% \u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\r\n  x,,\u2368,[0.5]\u2368x \u2192 3.4E\u00af5 | -64% \u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\u2395\r\n  \u23495\u233f(1,\u2374x)\u2374x  \u2192 1.3E\u00af5 | -86% \u2395\u2395\u2395\u2395\u2395\u2395<\/code><\/pre>\n<p>This is largely because I had spent a lot of time improving Transpose with Boolean arguments of various shapes in version 16 (the comparison above looks very different in version 15). Transpose on a short but wide Boolean matrix uses a technique that I call bit interleaving, which would unfortunately require another blog post to explain. To transpose a matrix with r rows, I move across the rows, using some special tricks to insert (r-1) zeroes after each bit in each one, and combine them using bitwise or. To instead replicate a vector by r, I modified this to expand the one argument as though it were going to be combined with other rows, but instead of doing that, I combined it with itself by multiplying by the number whose base-2 representation consists of r ones. (C programmers may notice that multiplying by this number is the same as shifting to the left by r and then subtracting the original value. In fact, using multiplication is faster\u2014x86 variable shifts are slow!)<\/p>\n<p>Bit interleaving is a somewhat complicated algorithm, but it had all been done by the time I started on Replicate, and modifying it didn&#8217;t take long.<\/p>\n<h2>Large expansion factors, the obvious way<\/h2>\n<p>The bit-interleaving algorithm is very fast for small numbers and gets slower as the expansion factor increases. Above 64 it is no longer usable because it only writes one word at a time, while each bit should expand to more than a word. I chose to stop using it after 32, as it turns out we can get just about the same performance at 33 using a different approach.<\/p>\n<p>The old approach, on the other hand, is only about half as fast at this expansion factor. Version 16&#8217;s algorithm reads from the right argument one bit at a time, then writes that bit the appropriate number of times to the result by writing one partial byte and then using <a href=\"https:\/\/linux.die.net\/man\/3\/memset\" target=\"_blank\" rel=\"noopener\">memset<\/a> (which may spill over into the next bit&#8217;s area since memset can only write whole bytes; it will be overwritten when we get to the next bit). This works fine for large enough left arguments, and scales up very well: memset is provided by the C standard library and will push bytes to memory as fast as possible. But for small values it is not so good: the call to memset branches a few times based on the unpredictable size of the write, which incurs a steep branch misprediction penalty.<\/p>\n<p>There&#8217;s no easy way to get around the penalty for writing some bits at a variable offset. If the expansion factor isn&#8217;t a multiple of eight, then the number of bytes each expanded bit touches will always vary by one, and having to check whether to write that byte results in an unpredictable branch. There are ways to avoid a check like this (overwriting is one), but these tend to be fast only on a small range of expansion factors and to be very tricky to write and bug-prone, especially at the boundaries of the result.<\/p>\n<h2>A new idea<\/h2>\n<p>So the problem is that writing a weird number of bits at a time is expensive. But it&#8217;s possible to get away with only writing one bit for each &#8220;memset&#8221; we want to perform! The trick is found in a pair of inverse functions well-known for their usefulness in Boolean APL code. These are <code class=\"language-apl\">{2\u2260\/0,\u2375}<\/code> and <code class=\"language-apl\">\u2260\\<\/code>, and they are analogous to the pairwise difference <code class=\"language-apl\">{\u00af2-\/0,\u2375}<\/code> and progressive sum <code class=\"language-apl\">+\\<\/code>. Dyalog 16 has fast code for <code class=\"language-apl\">\u2260\\<\/code> provided by Bob Bernecky, so I knew it was a good building block for other high-performance primitives.<br \/>\n<a href=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/06\/fig1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/06\/fig1.png\" alt=\"\" width=\"540\" height=\"310\" class=\"aligncenter size-full wp-image-5193\" srcset=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/06\/fig1.png 540w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/06\/fig1-300x172.png 300w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/06\/fig1-500x287.png 500w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a><br \/>\nThe diagram above illustrates the relationships between scans and pairwise differences. In the bitwise world consisting only of even and odd, <code class=\"language-apl\">\u2260<\/code> is like <code class=\"language-apl\">+<\/code>. But each number is its own negative, so it&#8217;s also like <code class=\"language-apl\">-<\/code>. More precisely, since <code class=\"language-apl\">\u237a\u2260\u2375<\/code> is the same as <code class=\"language-apl\">2|\u237a+\u2375<\/code> on Booleans (check for yourself!) and modulus distributes over addition when the final result has a modulus applied to it, <code class=\"language-apl\">\u2260\\<\/code> is equivalent to <code class=\"language-apl\">2|+\\<\/code>. Similarly, <code class=\"language-apl\">{2\u2260\/\u2375}<\/code> or <code class=\"language-apl\">{\u00af2\u2260\/\u2375}<\/code> is the same as <code class=\"language-apl\">{2|\u00af2-\/\u2375}<\/code>. The diagram includes the extra zero in <code class=\"language-apl\">{2\u2260\/0,\u2375}<\/code> as part of the vectors in the top half of the diagram, but omits it from the functions used to label arrows to avoid clutter.<\/p>\n<p>Let&#8217;s take a look at the pairwise difference after we replicate a vector:<br \/>\n<a href=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5026\" src=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig0.png\" alt=\"fig0\" width=\"530\" height=\"172\" srcset=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig0.png 530w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig0-300x97.png 300w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig0-500x162.png 500w\" sizes=\"auto, (max-width: 530px) 100vw, 530px\" \/><\/a><br \/>\nIt&#8217;s very sparse\u2014the only one bits come at indices which are multiples of five. This is because expanding <code class=\"language-apl\">v<\/code> multiplies the indices of its pairwise difference by five:<\/p>\n<pre><code class=\"language-apl\">      v\u21901 1 0 1 0 0 0 1\r\n      \u2378 2\u2260\/0, v  \u235d \u2378\u2375  \u2190\u2192  \u2375\/\u2373\u2374\u2375\r\n0 2 3 4 7\r\n      \u2378 2\u2260\/0, 5\/v\r\n0 10 15 20 35<\/code><\/pre>\n<p>We can recover <code class=\"language-apl\">5\/v<\/code> using the inverse <code class=\"language-apl\">\u2260\\<\/code> of pairwise difference. So to expand, we can add four zeros after each bit under the <code class=\"language-apl\">\u2260\\\u2363\u00af1<\/code> function (which is the same as pairwise difference):<\/p>\n<pre><code class=\"language-apl\">      \u2260\\ ,5\u2191[1]\u236a \u2260\\\u2363\u00af1\u22a2 v\r\n1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1<\/code><\/pre>\n<p>Of course <code class=\"language-apl\">\u2191<\/code> isn&#8217;t particularly fast on these arguments, so we will have to write our own version, which sets the entire result to zero and then writes bits in the appropriate places. Implemented properly, this goes pretty quick, the only substantial costs being a variable shift and one byte-sized write per element on the right. It&#8217;s completely branchless. Follow up with the fast <code class=\"language-apl\">\u2260\\<\/code> algorithm and we have a pretty good solution.<\/p>\n<p>This solution performs more writes than it has to, since it writes each difference bit even if it is zero. But trying to get rid of the extra writes is a losing battle. Checking the value before each write takes much longer than just writing it, and even a fancy strategy, like using the count-leading-zeros instruction to quickly skip over all zeros before each one, will be slower for arguments without many zeros in the difference vector. But there is another way to make this algorithm a little faster, coming up after we tie up some loose ends\u2026<\/p>\n<h2>Back to Index, and more xor<\/h2>\n<p>What about my unexplained formula for indexing? The expression<\/p>\n<pre><code class=\"language-apl\">      y[x;]  \u2190\u2192  (((\u2262y)\/\u236ax) \u2227\u23641 \u2260\u233fy) \u2260\u23641 \u22a3\u233fy<\/code><\/pre>\n<p>also relies on insight about <code class=\"language-apl\">\u2260<\/code>, but in a completely different context. Let&#8217;s simplify it a bit to see what&#8217;s going on. Suppose we have two Boolean arrays <code class=\"language-apl\">b<\/code> and <code class=\"language-apl\">c<\/code> of the same shape, and we want to use the bit <code class=\"language-apl\">a<\/code> to select one of them: we want an expression that returns <code class=\"language-apl\">b<\/code> if <code class=\"language-apl\">a=0<\/code> and <code class=\"language-apl\">c<\/code> if <code class=\"language-apl\">a=1<\/code>. For real numbers, we might use a linear combination:<\/p>\n<pre><code class=\"language-apl\">      b + a\u00d7(c-b)<\/code><\/pre>\n<p>If <code class=\"language-apl\">a=0<\/code>, then the <code class=\"language-apl\">c-b<\/code> term is removed and we get <code class=\"language-apl\">b<\/code>. If <code class=\"language-apl\">a=1<\/code>, then it stays and we have <code class=\"language-apl\">(b+(c-b)) = c<\/code>.<br \/>\nThis formula is also valid for Boolean arrays, of course, but introducing an integer <code class=\"language-apl\">c-b<\/code> would be a poor choice from a performance standpoint. Instead, we can use the insight that <code class=\"language-apl\">\u2260<\/code> performs the function of both <code class=\"language-apl\">+<\/code> and <code class=\"language-apl\">-<\/code> in the bitwise world, and transliterate our formula into<\/p>\n<pre><code class=\"language-apl\">      b \u2260 a\u2227(c\u2260b)<\/code><\/pre>\n<p>Again, if <code class=\"language-apl\">a=0<\/code>, then the <code class=\"language-apl\">c\u2260b<\/code> is zeroed out, and we end up with <code class=\"language-apl\">b\u22600<\/code>, which is the same as <code class=\"language-apl\">b<\/code>. If <code class=\"language-apl\">a=1<\/code>, then it stays, leaving <code class=\"language-apl\">(b\u2260(c\u2260b))<\/code>, which gives <code class=\"language-apl\">c<\/code>.<\/p>\n<p>If <code class=\"language-apl\">y<\/code> is a shape <code class=\"language-apl\">2 m<\/code> array <code class=\"language-apl\">y\u2190b,[\u00af0.5]c<\/code>, then we have <code class=\"language-apl\">b \u2261 \u22a3\u233fy<\/code> and <code class=\"language-apl\">(c\u2260b) \u2261 \u2260\u233fy<\/code>. So <code class=\"language-apl\">b \u2260 a\u2227(c\u2260b)<\/code> is, rearranging some, the same as <code class=\"language-apl\">(a \u2227 \u2260\u233fy) \u2260 \u22a3\u233fy<\/code>. But there is an implicit scalar extension in the <code class=\"language-apl\">\u2227<\/code> function; we can make this explicit by writing <code class=\"language-apl\">((m\/a) \u2227 \u2260\u233fy) \u2260 \u22a3\u233fy<\/code>. Now it&#8217;s clear that to select using each bit of a vector <code class=\"language-apl\">x<\/code>, we need to turn each bit into a row with length <code class=\"language-apl\">m<\/code>, and then apply the <code class=\"language-apl\">\u2227<\/code> and <code class=\"language-apl\">\u2260<\/code> functions on rows, giving the formula I showed earlier.<\/p>\n<p>How about Outer Product? That one&#8217;s easier, with no Boolean magic required. For vector arguments, <code class=\"language-apl\">\u237a \u2218.f \u2375<\/code> is identical to <code class=\"language-apl\">((\u2262\u2375)\/\u236a\u237a) f ((\u2262\u237a),\u2262\u2375)\u2374\u2375<\/code>, and the same computation works for general arrays if we use the ravel length <code class=\"language-apl\">\u00d7\/\u2218\u2374<\/code> instead of the count <code class=\"language-apl\">\u2262<\/code>. When the right argument has more than around 1024 bits, replicate becomes slower than the old way of just pairing each bit of the left argument with the whole of the right, so we use that method instead.<\/p>\n<h2>Speeding up \u2260\\<\/h2>\n<p>We left off with an expansion algorithm whose cost is dominated by the time to compute <code class=\"language-apl\">\u2260\\<\/code> on a vector. That computation is based on a fast method for <code class=\"language-apl\">\u2260\\<\/code> on a single machine word. It moves along the argument vector (which is the same as the result vector in this case) one word at a time, keeping track of the most recent bit of the result. Then each word of the result is obtained from the fast xor-scan of that word in the argument, xor-ed with the carried bit. For arbitrary input vectors, this is the best algorithm. But the word-length <code class=\"language-apl\">\u2260\\<\/code> computation is slowing us down, and it turns out we can do a lot better.<\/p>\n<p>Writing a single bit has the same cost as writing an entire aligned machine word. So writing one bit at a time, while much better than writing a variable number of bits with arbitrary alignment, represents some wasted effort. Can we make the impending <code class=\"language-apl\">\u2260\\<\/code> computation easier by using full-word writes?<\/p>\n<p>A definite &#8220;yes&#8221; for that question. In fact, we can eliminate all of the intra-word computation. Consider the effect of a bit that we write on the final result after applying <code class=\"language-apl\">\u2260\\<\/code>. That bit will be spread out over all of the subsequent bits, flipping each one. In order to produce this effect on a single word (leaving the task of flipping subsequent words for later), we can thus xor an aligned word with a word which is zero before that bit and one at that bit and later. We can get this word just by shifting the all-ones word right by an appropriate amount. And then we can omit the expensive word-size <code class=\"language-apl\">\u2260\\<\/code> computation entirely, so that to perform the final pass we simply repeatedly xor the next word with the current one&#8217;s last bit. This greatly reduces the cost of the final pass at very little expense to the pass before it (xor-ing rather than setting a word requires reading that word&#8217;s value first, so it&#8217;s not quite free).<br \/>\n<a href=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5028\" src=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig2.png\" alt=\"fig2\" width=\"747\" height=\"405\" srcset=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig2.png 747w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig2-300x162.png 300w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/01\/fig2-500x271.png 500w\" sizes=\"auto, (max-width: 747px) 100vw, 747px\" \/><\/a><\/p>\n<p>To summarize, there are three passes:<\/p>\n<ul>\n<li>Set all bits of the result to zero.<\/li>\n<li>For each bit in the right argument, xor the appropriate word in the result with a word which is all ones after the place where that bit starts in the result.<\/li>\n<li>Iterate across words of the result, xor-ing each with the last bit of the previous word (after finishing computation on that word).<\/li>\n<\/ul>\n<p>For expansion factors between 32 and 256, this is the fastest method I know of. Below 32, interleaving is faster, and above 256 simply using memset will do the trick.<\/p>\n<p>The xor-based algorithm also works for Replicate or Expand when the left argument is a vector, and in Dyalog 17 it is used for both of these whenever the average expansion factor, which is equal to the ratio of result length to argument length, is 256 or less.<\/p>\n<h2>The end result<\/h2>\n<p><a href=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5046\" src=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf1.png\" alt=\"perf1\" width=\"800\" height=\"574\" srcset=\"https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf1.png 800w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf1-300x215.png 300w, https:\/\/www.dyalog.com\/blog\/wp-content\/uploads\/2018\/02\/perf1-418x300.png 418w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><br \/>\nThe graph above shows the gains in scalar-Boolean replicate between versions 16.0 and 17.0. Note the huge scale of the vertical axis\u2014replicate is just short of a hundred times faster at the far left! Version 17&#8217;s Replicate is split into three parts, with the performance of each individual algorithm shown under the overall result. From left to right, these are the algorithm with bit interleaving, the xor-based algorithm described in the last section, and an algorithm with memset. The last of these is the same basic strategy used by version 16, but there are some improvements in version 17 that make it about 45% faster for short arguments.<\/p>\n<p>The seams between these algorithms are not quite perfect on my machine, but they are not off by enough to damage performance significantly. The cutoffs favor the middle, xor-based algorithm a little. I think this is appropriate because that algorithm is likely to have consistent performance even on older machines and different architectures. In contrast, bit interleaving uses the BMI2 instruction set (available on x86 processors since 2013) and is slower if it is not present, and memset may perform differently with other implementations of the standard library or depending on available vector instruction sets. Our xor-based algorithm uses only very widely available instructions, and one of the costs\u2014the variable shift used on the all-ones word\u2014is actually much faster on other architectures because of a design flaw in x86. An excellent addition to Dyalog APL!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The chart above compares the performance of \u2218.\u2227 in Dyalog versions 16.0 and 17.0. The improvement is a factor of 3-4 across the whole range (except at multiple-of-8 lengths, where 16.0 spikes up). That&#8217;s not easy to get, especially for &hellip; <a href=\"https:\/\/www.dyalog.com\/blog\/2018\/06\/expanding-bits-in-shrinking-time\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-5013","post","type-post","status-publish","format-standard","hentry","category-implementation"],"_links":{"self":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/5013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/comments?post=5013"}],"version-history":[{"count":22,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/5013\/revisions"}],"predecessor-version":[{"id":5194,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/posts\/5013\/revisions\/5194"}],"wp:attachment":[{"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/media?parent=5013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/categories?post=5013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dyalog.com\/blog\/wp-json\/wp\/v2\/tags?post=5013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}