Show HN: 10-40% faster LZMA decoder using x86 CMOVcc
Decent speedup on my 3970x.  Including this patch reduced the number of instructions in lzma_decoder.s (using gcc 8.3.1) by about 8% (4417 lines of asm vs 4824).  With perf stat, an astonishing branches-missed reduction from 409K to 104K.<p>Using the firefox example from the gist:<p><pre><code>  $ tar -cJf lib.tar.xz &#x2F;usr&#x2F;lib64&#x2F;firefox
</code></pre>
The xz shipped from the system:<p><pre><code>  $ perf stat xz -c -d lib.tar.xz &gt; &#x2F;dev&#x2F;null                                                                               

  Performance counter stats for &#x27;xz -c -d lib.tar.xz&#x27;:

          4,650.32 msec task-clock:u              #    1.000 CPUs utilized          
                 0      context-switches:u        #    0.000 K&#x2F;sec                  
                 0      cpu-migrations:u          #    0.000 K&#x2F;sec                  
               591      page-faults:u             #    0.127 K&#x2F;sec                  
    19,849,912,300      cycles:u                  #    4.269 GHz                      (83.33%)
       425,290,878      stalled-cycles-frontend:u #    2.14% frontend cycles idle     (83.33%)
     1,831,640,390      stalled-cycles-backend:u  #    9.23% backend cycles idle      (83.34%)
    23,973,036,103      instructions:u            #    1.21  insn per cycle         
                                                  #    0.08  stalled cycles per insn  (83.33%)
     2,939,144,233      branches:u                #  632.031 M&#x2F;sec                    (83.34%)
       409,371,860      branch-misses:u           #   13.93% of all branches          (83.33%)

       4.650679926 seconds time elapsed

       4.611657000 seconds user
       0.011931000 seconds sys
</code></pre>
The xz patched.<p><pre><code>  $ git clone http:&#x2F;&#x2F;git.tukaani.org&#x2F;xz.git
  $ cd xz&#x2F;src
  $ patch -l -p1 &lt; ..&#x2F;faster_lxma_decoder_x86.patch
  $ cd .. ; autogen.sh &amp;&amp; configure &amp;&amp; make
  $ LD_PRELOAD=.&#x2F;liblzma&#x2F;.libs&#x2F;liblzma.so
  $ perf stat .&#x2F;xz&#x2F;.libs&#x2F;xz -c -d ..&#x2F;..&#x2F;lib.tar.xz &gt; &#x2F;dev&#x2F;null                                                              

  Performance counter stats for &#x27;.&#x2F;xz&#x2F;.libs&#x2F;xz -c -d ..&#x2F;..&#x2F;lib.tar.xz&#x27;:

          3,578.54 msec task-clock:u              #    1.000 CPUs utilized          
                 0      context-switches:u        #    0.000 K&#x2F;sec                  
                 0      cpu-migrations:u          #    0.000 K&#x2F;sec                  
               593      page-faults:u             #    0.166 K&#x2F;sec                  
    15,186,685,715      cycles:u                  #    4.244 GHz                      (83.32%)
       108,663,507      stalled-cycles-frontend:u #    0.72% frontend cycles idle     (83.32%)
     8,753,057,119      stalled-cycles-backend:u  #   57.64% backend cycles idle      (83.34%)
    27,322,182,837      instructions:u            #    1.80  insn per cycle         
                                                  #    0.32  stalled cycles per insn  (83.35%)
     1,979,944,734      branches:u                #  553.282 M&#x2F;sec                    (83.34%)
       104,752,154      branch-misses:u           #    5.29% of all branches          (83.34%)

       3.578973194 seconds time elapsed

       3.549329000 seconds user
       0.011942000 seconds sys</code></pre>