From c197d686a9737082006dc24ba0c36f0c1d72b15b Mon Sep 17 00:00:00 2001 From: nafi Date: Tue, 22 Jan 2019 12:50:51 -0800 Subject: [PATCH] Optimize snappy compression by about 2.2%. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'jpg_200' is notably optimized by ~8%. name old time/op new time/op delta BM_UFlat/0 [html ] 41.8µs ± 0% 41.9µs ± 0% +0.33% (p=0.016 n=5+5) BM_UFlat/1 [urls ] 590µs ± 0% 590µs ± 0% ~ (p=1.000 n=5+5) BM_UFlat/2 [jpg ] 7.14µs ± 1% 7.12µs ± 1% ~ (p=0.310 n=5+5) BM_UFlat/3 [jpg_200 ] 129ns ± 0% 129ns ± 0% ~ (p=0.167 n=5+5) BM_UFlat/4 [pdf ] 8.21µs ± 0% 8.20µs ± 0% ~ (p=0.310 n=5+5) BM_UFlat/5 [html4 ] 220µs ± 1% 220µs ± 0% ~ (p=0.421 n=5+5) BM_UFlat/6 [txt1 ] 193µs ± 0% 193µs ± 0% ~ (p=0.841 n=5+5) BM_UFlat/7 [txt2 ] 171µs ± 0% 171µs ± 0% ~ (p=0.056 n=5+5) BM_UFlat/8 [txt3 ] 512µs ± 0% 511µs ± 0% ~ (p=0.310 n=5+5) BM_UFlat/9 [txt4 ] 716µs ± 0% 716µs ± 0% ~ (p=1.000 n=5+5) BM_UFlat/10 [pb ] 38.8µs ± 1% 38.8µs ± 0% ~ (p=1.000 n=5+5) BM_UFlat/11 [gaviota ] 190µs ± 0% 190µs ± 0% ~ (p=0.841 n=5+5) BM_UFlat/12 [cp ] 14.4µs ± 1% 14.4µs ± 1% ~ (p=0.151 n=5+5) BM_UFlat/13 [c ] 7.33µs ± 0% 7.32µs ± 0% ~ (p=0.690 n=5+5) BM_UFlat/14 [lsp ] 2.30µs ± 0% 2.31µs ± 1% ~ (p=0.548 n=5+5) BM_UFlat/15 [xls ] 984µs ± 0% 984µs ± 0% ~ (p=1.000 n=5+5) BM_UFlat/16 [xls_200 ] 213ns ± 0% 213ns ± 0% ~ (p=0.310 n=5+5) BM_UFlat/17 [bin ] 277µs ± 0% 278µs ± 0% ~ (p=0.690 n=5+5) BM_UFlat/18 [bin_200 ] 101ns ± 0% 102ns ± 0% ~ (p=0.190 n=5+4) BM_UFlat/19 [sum ] 29.6µs ± 0% 29.6µs ± 0% ~ (p=0.310 n=5+5) BM_UFlat/20 [man ] 2.98µs ± 1% 2.98µs ± 0% ~ (p=1.000 n=5+5) BM_UValidate/0 [html ] 33.5µs ± 0% 33.6µs ± 0% ~ (p=0.310 n=5+5) BM_UValidate/1 [urls ] 443µs ± 0% 443µs ± 0% ~ (p=0.841 n=5+5) BM_UValidate/2 [jpg ] 146ns ± 0% 146ns ± 0% ~ (p=0.222 n=5+5) BM_UValidate/3 [jpg_200 ] 95.6ns ± 0% 95.5ns ± 0% ~ (p=0.421 n=5+5) BM_UValidate/4 [pdf ] 2.92µs ± 0% 2.92µs ± 0% ~ (p=0.841 n=5+5) BM_UIOVec/0 [html ] 122µs ± 0% 122µs ± 0% ~ (p=0.548 n=5+5) BM_UIOVec/1 [urls ] 1.08ms ± 0% 1.08ms ± 0% ~ (p=0.151 n=5+5) BM_UIOVec/2 [jpg ] 7.48µs ± 5% 7.75µs ±12% ~ (p=0.690 n=5+5) BM_UIOVec/3 [jpg_200 ] 331ns ± 1% 327ns ± 1% ~ (p=0.056 n=5+5) BM_UIOVec/4 [pdf ] 12.0µs ± 0% 12.0µs ± 0% ~ (p=1.000 n=5+5) BM_UFlatSink/0 [html ] 41.7µs ± 0% 41.8µs ± 0% ~ (p=0.421 n=5+5) BM_UFlatSink/1 [urls ] 591µs ± 0% 590µs ± 0% ~ (p=0.151 n=5+5) BM_UFlatSink/2 [jpg ] 7.18µs ± 2% 7.31µs ± 3% ~ (p=0.190 n=4+5) BM_UFlatSink/3 [jpg_200 ] 134ns ± 2% 134ns ± 2% ~ (p=1.000 n=5+5) BM_UFlatSink/4 [pdf ] 8.22µs ± 0% 8.23µs ± 0% ~ (p=0.730 n=4+5) BM_UFlatSink/5 [html4 ] 219µs ± 0% 219µs ± 0% ~ (p=0.548 n=5+5) BM_UFlatSink/6 [txt1 ] 193µs ± 0% 193µs ± 0% ~ (p=0.095 n=5+5) BM_UFlatSink/7 [txt2 ] 171µs ± 0% 171µs ± 0% ~ (p=0.841 n=5+5) BM_UFlatSink/8 [txt3 ] 512µs ± 0% 512µs ± 0% ~ (p=0.548 n=5+5) BM_UFlatSink/9 [txt4 ] 718µs ± 0% 718µs ± 0% ~ (p=0.548 n=5+5) BM_UFlatSink/10 [pb ] 38.7µs ± 0% 38.6µs ± 0% ~ (p=0.222 n=5+5) BM_UFlatSink/11 [gaviota ] 191µs ± 0% 190µs ± 0% ~ (p=0.690 n=5+5) BM_UFlatSink/12 [cp ] 14.3µs ± 0% 14.4µs ± 0% ~ (p=0.222 n=5+5) BM_UFlatSink/13 [c ] 7.33µs ± 0% 7.34µs ± 1% ~ (p=0.690 n=5+5) BM_UFlatSink/14 [lsp ] 2.29µs ± 1% 2.30µs ± 1% ~ (p=0.095 n=5+5) BM_UFlatSink/15 [xls ] 981µs ± 0% 980µs ± 0% ~ (p=0.310 n=5+5) BM_UFlatSink/16 [xls_200 ] 216ns ± 1% 216ns ± 1% ~ (p=1.000 n=5+5) BM_UFlatSink/17 [bin ] 277µs ± 0% 277µs ± 0% ~ (p=1.000 n=5+5) BM_UFlatSink/18 [bin_200 ] 104ns ± 0% 104ns ± 1% ~ (p=0.905 n=5+4) BM_UFlatSink/19 [sum ] 29.5µs ± 0% 29.5µs ± 0% ~ (p=0.222 n=5+5) BM_UFlatSink/20 [man ] 3.01µs ± 1% 3.01µs ± 0% ~ (p=0.730 n=5+4) BM_ZFlat/0 [html (22.31 %) ] 126µs ± 0% 124µs ± 0% -1.66% (p=0.008 n=5+5) BM_ZFlat/1 [urls (47.78 %) ] 1.68ms ± 0% 1.63ms ± 0% -2.73% (p=0.008 n=5+5) BM_ZFlat/2 [jpg (99.95 %) ] 11.6µs ± 8% 11.4µs ± 6% ~ (p=0.310 n=5+5) BM_ZFlat/3 [jpg_200 (73.00 %)] 369ns ± 1% 340ns ± 1% -7.93% (p=0.008 n=5+5) BM_ZFlat/4 [pdf (83.30 %) ] 14.9µs ± 4% 14.4µs ± 1% -3.56% (p=0.008 n=5+5) BM_ZFlat/5 [html4 (22.52 %) ] 551µs ± 0% 545µs ± 0% -1.21% (p=0.008 n=5+5) BM_ZFlat/6 [txt1 (57.88 %) ] 540µs ± 0% 534µs ± 0% -1.15% (p=0.008 n=5+5) BM_ZFlat/7 [txt2 (61.91 %) ] 480µs ± 0% 475µs ± 0% -1.13% (p=0.008 n=5+5) BM_ZFlat/8 [txt3 (54.99 %) ] 1.44ms ± 0% 1.43ms ± 0% -1.14% (p=0.008 n=5+5) BM_ZFlat/9 [txt4 (66.26 %) ] 1.97ms ± 0% 1.95ms ± 0% -1.00% (p=0.008 n=5+5) BM_ZFlat/10 [pb (19.68 %) ] 110µs ± 0% 107µs ± 0% -2.77% (p=0.008 n=5+5) BM_ZFlat/11 [gaviota (37.72 %)] 413µs ± 0% 411µs ± 0% -0.50% (p=0.008 n=5+5) BM_ZFlat/12 [cp (48.12 %) ] 46.6µs ± 1% 44.8µs ± 1% -3.89% (p=0.008 n=5+5) BM_ZFlat/13 [c (42.47 %) ] 17.8µs ± 0% 17.5µs ± 0% -1.87% (p=0.008 n=5+5) BM_ZFlat/14 [lsp (48.37 %) ] 5.62µs ± 1% 5.35µs ± 1% -4.81% (p=0.008 n=5+5) BM_ZFlat/15 [xls (41.23 %) ] 1.63ms ± 0% 1.63ms ± 0% ~ (p=0.310 n=5+5) BM_ZFlat/16 [xls_200 (78.00 %)] 393ns ± 1% 384ns ± 2% -2.45% (p=0.008 n=5+5) BM_ZFlat/17 [bin (18.11 %) ] 510µs ± 0% 503µs ± 0% -1.50% (p=0.016 n=4+5) BM_ZFlat/18 [bin_200 (7.50 %) ] 83.2ns ± 3% 84.5ns ± 4% ~ (p=0.206 n=5+5) BM_ZFlat/19 [sum (48.96 %) ] 80.0µs ± 0% 78.3µs ± 0% -2.20% (p=0.008 n=5+5) BM_ZFlat/20 [man (59.21 %) ] 7.79µs ± 1% 7.45µs ± 1% -4.38% (p=0.008 n=5+5) name old allocs/op new allocs/op delta BM_UFlat/0 [html ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/1 [urls ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/2 [jpg ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/3 [jpg_200 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/4 [pdf ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/5 [html4 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/6 [txt1 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/7 [txt2 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/8 [txt3 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/9 [txt4 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/10 [pb ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/11 [gaviota ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/12 [cp ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/13 [c ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/14 [lsp ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/15 [xls ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/16 [xls_200 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/17 [bin ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/18 [bin_200 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/19 [sum ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlat/20 [man ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UValidate/0 [html ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UValidate/1 [urls ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UValidate/2 [jpg ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UValidate/3 [jpg_200 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UValidate/4 [pdf ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UIOVec/0 [html ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UIOVec/1 [urls ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UIOVec/2 [jpg ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UIOVec/3 [jpg_200 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UIOVec/4 [pdf ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/0 [html ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/1 [urls ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/2 [jpg ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/3 [jpg_200 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/4 [pdf ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/5 [html4 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/6 [txt1 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/7 [txt2 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/8 [txt3 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/9 [txt4 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/10 [pb ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/11 [gaviota ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/12 [cp ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/13 [c ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/14 [lsp ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/15 [xls ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/16 [xls_200 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/17 [bin ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/18 [bin_200 ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/19 [sum ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_UFlatSink/20 [man ] 0.00 ±NaN% 0.00 ±NaN% ~ (all samples are equal) BM_ZFlat/0 [html (22.31 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/1 [urls (47.78 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/2 [jpg (99.95 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/3 [jpg_200 (73.00 %)] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/4 [pdf (83.30 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/5 [html4 (22.52 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/6 [txt1 (57.88 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/7 [txt2 (61.91 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/8 [txt3 (54.99 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/9 [txt4 (66.26 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/10 [pb (19.68 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/11 [gaviota (37.72 %)] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/12 [cp (48.12 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/13 [c (42.47 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/14 [lsp (48.37 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/15 [xls (41.23 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/16 [xls_200 (78.00 %)] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/17 [bin (18.11 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/18 [bin_200 (7.50 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/19 [sum (48.96 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ZFlat/20 [man (59.21 %) ] 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) name old peak-mem(Bytes)/op new peak-mem(Bytes)/op delta BM_UFlat/0 [html ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/1 [urls ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/2 [jpg ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/3 [jpg_200 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/4 [pdf ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/5 [html4 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/6 [txt1 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/7 [txt2 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/8 [txt3 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/9 [txt4 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/10 [pb ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/11 [gaviota ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/12 [cp ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/13 [c ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/14 [lsp ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/15 [xls ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/16 [xls_200 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/17 [bin ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/18 [bin_200 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/19 [sum ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlat/20 [man ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UValidate/0 [html ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UValidate/1 [urls ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UValidate/2 [jpg ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UValidate/3 [jpg_200 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UValidate/4 [pdf ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UIOVec/0 [html ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UIOVec/1 [urls ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UIOVec/2 [jpg ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UIOVec/3 [jpg_200 ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UIOVec/4 [pdf ] 4.00 ± 0% 4.00 ± 0% ~ (all samples are equal) BM_UFlatSink/0 [html ] 102k ± 0% 102k ± 0% ~ (all samples are equal) BM_UFlatSink/1 [urls ] 702k ± 0% 702k ± 0% ~ (all samples are equal) BM_UFlatSink/2 [jpg ] 123k ± 0% 123k ± 0% ~ (all samples are equal) BM_UFlatSink/3 [jpg_200 ] 201 ± 0% 201 ± 0% ~ (all samples are equal) BM_UFlatSink/4 [pdf ] 102k ± 0% 102k ± 0% ~ (all samples are equal) BM_UFlatSink/5 [html4 ] 410k ± 0% 410k ± 0% ~ (all samples are equal) BM_UFlatSink/6 [txt1 ] 152k ± 0% 152k ± 0% ~ (all samples are equal) BM_UFlatSink/7 [txt2 ] 125k ± 0% 125k ± 0% ~ (all samples are equal) BM_UFlatSink/8 [txt3 ] 427k ± 0% 427k ± 0% ~ (all samples are equal) BM_UFlatSink/9 [txt4 ] 482k ± 0% 482k ± 0% ~ (all samples are equal) BM_UFlatSink/10 [pb ] 119k ± 0% 119k ± 0% ~ (all samples are equal) BM_UFlatSink/11 [gaviota ] 184k ± 0% 184k ± 0% ~ (all samples are equal) BM_UFlatSink/12 [cp ] 24.6k ± 0% 24.6k ± 0% ~ (all samples are equal) BM_UFlatSink/13 [c ] 11.2k ± 0% 11.2k ± 0% ~ (all samples are equal) BM_UFlatSink/14 [lsp ] 3.72k ± 0% 3.72k ± 0% ~ (all samples are equal) BM_UFlatSink/15 [xls ] 1.03M ± 0% 1.03M ± 0% ~ (all samples are equal) BM_UFlatSink/16 [xls_200 ] 201 ± 0% 201 ± 0% ~ (all samples are equal) BM_UFlatSink/17 [bin ] 513k ± 0% 513k ± 0% ~ (all samples are equal) BM_UFlatSink/18 [bin_200 ] 201 ± 0% 201 ± 0% ~ (all samples are equal) BM_UFlatSink/19 [sum ] 38.2k ± 0% 38.2k ± 0% ~ (all samples are equal) BM_UFlatSink/20 [man ] 4.23k ± 0% 4.23k ± 0% ~ (all samples are equal) BM_ZFlat/0 [html (22.31 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/1 [urls (47.78 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/2 [jpg (99.95 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/3 [jpg_200 (73.00 %)] 30.7k ± 0% 30.7k ± 0% ~ (all samples are equal) BM_ZFlat/4 [pdf (83.30 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/5 [html4 (22.52 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/6 [txt1 (57.88 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/7 [txt2 (61.91 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/8 [txt3 (54.99 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/9 [txt4 (66.26 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/10 [pb (19.68 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/11 [gaviota (37.72 %)] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/12 [cp (48.12 %) ] 86.1k ± 0% 86.1k ± 0% ~ (all samples are equal) BM_ZFlat/13 [c (42.47 %) ] 57.0k ± 0% 57.0k ± 0% ~ (all samples are equal) BM_ZFlat/14 [lsp (48.37 %) ] 30.6k ± 0% 30.6k ± 0% ~ (all samples are equal) BM_ZFlat/15 [xls (41.23 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/16 [xls_200 (78.00 %)] 30.7k ± 0% 30.7k ± 0% ~ (all samples are equal) BM_ZFlat/17 [bin (18.11 %) ] 175k ± 0% 175k ± 0% ~ (all samples are equal) BM_ZFlat/18 [bin_200 (7.50 %) ] 30.7k ± 0% 30.7k ± 0% ~ (all samples are equal) BM_ZFlat/19 [sum (48.96 %) ] 116k ± 0% 116k ± 0% ~ (all samples are equal) BM_ZFlat/20 [man (59.21 %) ] 30.6k ± 0% 30.6k ± 0% ~ (all samples are equal) name old speed new speed delta BM_UFlat/0 [html ] 2.46GB/s ± 0% 2.45GB/s ± 1% ~ (p=0.841 n=5+5) BM_UFlat/1 [urls ] 1.19GB/s ± 1% 1.20GB/s ± 1% ~ (p=0.310 n=5+5) BM_UFlat/2 [jpg ] 17.3GB/s ± 1% 17.4GB/s ± 1% ~ (p=0.310 n=5+5) BM_UFlat/3 [jpg_200 ] 1.56GB/s ± 0% 1.56GB/s ± 0% ~ (p=0.190 n=4+5) BM_UFlat/4 [pdf ] 12.5GB/s ± 1% 12.5GB/s ± 0% ~ (p=0.548 n=5+5) BM_UFlat/5 [html4 ] 1.87GB/s ± 0% 1.87GB/s ± 1% ~ (p=1.000 n=5+5) BM_UFlat/6 [txt1 ] 791MB/s ± 1% 791MB/s ± 0% ~ (p=1.000 n=5+5) BM_UFlat/7 [txt2 ] 737MB/s ± 0% 738MB/s ± 0% ~ (p=0.841 n=5+5) BM_UFlat/8 [txt3 ] 839MB/s ± 0% 839MB/s ± 0% ~ (p=1.000 n=5+5) BM_UFlat/9 [txt4 ] 675MB/s ± 1% 674MB/s ± 0% ~ (p=0.730 n=5+4) BM_UFlat/10 [pb ] 3.08GB/s ± 1% 3.06GB/s ± 0% ~ (p=0.095 n=5+5) BM_UFlat/11 [gaviota ] 974MB/s ± 0% 976MB/s ± 0% ~ (p=0.238 n=5+5) BM_UFlat/12 [cp ] 1.70GB/s ± 0% 1.72GB/s ± 0% +1.07% (p=0.016 n=4+5) BM_UFlat/13 [c ] 1.53GB/s ± 0% 1.53GB/s ± 1% ~ (p=1.000 n=5+5) BM_UFlat/14 [lsp ] 1.62GB/s ± 1% 1.62GB/s ± 1% ~ (p=1.000 n=5+5) BM_UFlat/15 [xls ] 1.05GB/s ± 1% 1.05GB/s ± 0% ~ (p=0.556 n=5+4) BM_UFlat/16 [xls_200 ] 943MB/s ± 0% 940MB/s ± 0% ~ (p=0.151 n=5+5) BM_UFlat/17 [bin ] 1.86GB/s ± 1% 1.86GB/s ± 0% ~ (p=1.000 n=5+5) BM_UFlat/18 [bin_200 ] 1.99GB/s ± 0% 1.97GB/s ± 1% ~ (p=0.190 n=5+4) BM_UFlat/19 [sum ] 1.30GB/s ± 0% 1.30GB/s ± 1% ~ (p=0.151 n=5+5) BM_UFlat/20 [man ] 1.42GB/s ± 1% 1.42GB/s ± 0% ~ (p=1.000 n=5+5) BM_UValidate/0 [html ] 3.06GB/s ± 0% 3.06GB/s ± 1% ~ (p=1.000 n=5+5) BM_UValidate/1 [urls ] 1.59GB/s ± 0% 1.59GB/s ± 0% ~ (p=0.095 n=5+5) BM_UValidate/2 [jpg ] 845GB/s ± 0% 845GB/s ± 0% ~ (p=1.000 n=5+5) BM_UValidate/3 [jpg_200 ] 2.10GB/s ± 0% 2.10GB/s ± 0% ~ (p=0.310 n=5+5) BM_UValidate/4 [pdf ] 35.1GB/s ± 0% 35.1GB/s ± 1% ~ (p=0.690 n=5+5) BM_UIOVec/0 [html ] 843MB/s ± 0% 847MB/s ± 1% ~ (p=0.222 n=5+5) BM_UIOVec/1 [urls ] 652MB/s ± 1% 652MB/s ± 1% ~ (p=0.310 n=5+5) BM_UIOVec/2 [jpg ] 16.5GB/s ± 5% 16.0GB/s ±10% ~ (p=0.841 n=5+5) BM_UIOVec/3 [jpg_200 ] 606MB/s ± 1% 614MB/s ± 1% ~ (p=0.056 n=5+5) BM_UIOVec/4 [pdf ] 8.57GB/s ± 0% 8.57GB/s ± 0% ~ (p=0.343 n=4+4) BM_UFlatSink/0 [html ] 2.47GB/s ± 0% 2.45GB/s ± 0% -0.58% (p=0.016 n=5+5) BM_UFlatSink/1 [urls ] 1.19GB/s ± 0% 1.20GB/s ± 0% ~ (p=0.548 n=5+5) BM_UFlatSink/2 [jpg ] 16.4GB/s ±19% 16.9GB/s ± 4% ~ (p=0.690 n=5+5) BM_UFlatSink/3 [jpg_200 ] 1.50GB/s ± 2% 1.50GB/s ± 2% ~ (p=1.000 n=5+5) BM_UFlatSink/4 [pdf ] 12.5GB/s ± 0% 12.5GB/s ± 0% ~ (p=0.730 n=4+5) BM_UFlatSink/5 [html4 ] 1.87GB/s ± 1% 1.88GB/s ± 0% ~ (p=0.421 n=5+5) BM_UFlatSink/6 [txt1 ] 793MB/s ± 0% 792MB/s ± 1% ~ (p=0.690 n=5+5) BM_UFlatSink/7 [txt2 ] 736MB/s ± 0% 736MB/s ± 1% ~ (p=0.841 n=5+5) BM_UFlatSink/8 [txt3 ] 839MB/s ± 0% 839MB/s ± 0% ~ (p=0.548 n=5+5) BM_UFlatSink/9 [txt4 ] 675MB/s ± 0% 675MB/s ± 0% ~ (p=0.222 n=5+5) BM_UFlatSink/10 [pb ] 3.07GB/s ± 0% 3.09GB/s ± 0% +0.54% (p=0.016 n=5+5) BM_UFlatSink/11 [gaviota ] 973MB/s ± 0% 971MB/s ± 0% ~ (p=0.151 n=5+5) BM_UFlatSink/12 [cp ] 1.72GB/s ± 1% 1.71GB/s ± 1% ~ (p=0.421 n=5+5) BM_UFlatSink/13 [c ] 1.53GB/s ± 1% 1.52GB/s ± 0% ~ (p=0.841 n=5+5) BM_UFlatSink/14 [lsp ] 1.63GB/s ± 0% 1.62GB/s ± 1% ~ (p=0.222 n=5+5) BM_UFlatSink/15 [xls ] 1.06GB/s ± 0% 1.05GB/s ± 0% ~ (p=0.111 n=4+5) BM_UFlatSink/16 [xls_200 ] 932MB/s ± 1% 928MB/s ± 1% ~ (p=0.548 n=5+5) BM_UFlatSink/17 [bin ] 1.86GB/s ± 0% 1.86GB/s ± 1% ~ (p=1.000 n=5+5) BM_UFlatSink/18 [bin_200 ] 1.93GB/s ± 1% 1.94GB/s ± 1% ~ (p=0.730 n=5+4) BM_UFlatSink/19 [sum ] 1.30GB/s ± 0% 1.30GB/s ± 1% ~ (p=0.690 n=5+5) BM_UFlatSink/20 [man ] 1.41GB/s ± 1% 1.41GB/s ± 2% ~ (p=0.690 n=5+5) BM_ZFlat/0 [html (22.31 %) ] 815MB/s ± 1% 829MB/s ± 0% +1.78% (p=0.008 n=5+5) BM_ZFlat/1 [urls (47.78 %) ] 420MB/s ± 1% 432MB/s ± 1% +2.87% (p=0.008 n=5+5) BM_ZFlat/2 [jpg (99.95 %) ] 10.7GB/s ± 8% 10.9GB/s ± 6% ~ (p=0.421 n=5+5) BM_ZFlat/3 [jpg_200 (73.00 %)] 544MB/s ± 2% 590MB/s ± 1% +8.41% (p=0.008 n=5+5) BM_ZFlat/4 [pdf (83.30 %) ] 6.92GB/s ± 3% 7.16GB/s ± 1% +3.51% (p=0.008 n=5+5) BM_ZFlat/5 [html4 (22.52 %) ] 745MB/s ± 0% 755MB/s ± 0% +1.34% (p=0.008 n=5+5) BM_ZFlat/6 [txt1 (57.88 %) ] 282MB/s ± 0% 285MB/s ± 1% +1.04% (p=0.008 n=5+5) BM_ZFlat/7 [txt2 (61.91 %) ] 262MB/s ± 0% 265MB/s ± 0% +1.22% (p=0.008 n=5+5) BM_ZFlat/8 [txt3 (54.99 %) ] 297MB/s ± 0% 300MB/s ± 0% +1.09% (p=0.008 n=5+5) BM_ZFlat/9 [txt4 (66.26 %) ] 246MB/s ± 1% 248MB/s ± 0% +0.95% (p=0.008 n=5+5) BM_ZFlat/10 [pb (19.68 %) ] 1.08GB/s ± 1% 1.11GB/s ± 1% +2.57% (p=0.008 n=5+5) BM_ZFlat/11 [gaviota (37.72 %)] 449MB/s ± 1% 451MB/s ± 0% ~ (p=0.056 n=5+5) BM_ZFlat/12 [cp (48.12 %) ] 530MB/s ± 1% 552MB/s ± 0% +4.17% (p=0.008 n=5+5) BM_ZFlat/13 [c (42.47 %) ] 628MB/s ± 1% 640MB/s ± 0% +1.85% (p=0.008 n=5+5) BM_ZFlat/14 [lsp (48.37 %) ] 665MB/s ± 0% 697MB/s ± 1% +4.71% (p=0.008 n=5+5) BM_ZFlat/15 [xls (41.23 %) ] 635MB/s ± 0% 634MB/s ± 0% ~ (p=0.310 n=5+5) BM_ZFlat/16 [xls_200 (78.00 %)] 511MB/s ± 1% 522MB/s ± 2% +2.23% (p=0.008 n=5+5) BM_ZFlat/17 [bin (18.11 %) ] 1.01GB/s ± 1% 1.02GB/s ± 0% +1.67% (p=0.008 n=5+5) BM_ZFlat/18 [bin_200 (7.50 %) ] 2.41GB/s ± 3% 2.37GB/s ± 4% ~ (p=0.222 n=5+5) BM_ZFlat/19 [sum (48.96 %) ] 480MB/s ± 0% 490MB/s ± 1% +2.24% (p=0.008 n=5+5) BM_ZFlat/20 [man (59.21 %) ] 545MB/s ± 0% 569MB/s ± 1% +4.38% (p=0.008 n=5+5) --- snappy.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/snappy.cc b/snappy.cc index 0f2d2ac..2d9436d 100644 --- a/snappy.cc +++ b/snappy.cc @@ -362,18 +362,16 @@ static inline char* EmitLiteral(char* op, // Fits in tag byte *op++ = LITERAL | (n << 2); } else { - // Encode in upcoming bytes - char* base = op; - int count = 0; - op++; - while (n > 0) { - *op++ = n & 0xff; - n >>= 8; - count++; - } + int count = (Bits::Log2Floor(n) >> 3) + 1; assert(count >= 1); assert(count <= 4); - *base = LITERAL | ((59+count) << 2); + *op++ = LITERAL | ((59 + count) << 2); + // Encode in upcoming bytes. + // Write 4 bytes, though we may care about only 1 of them. The output buffer + // is guaranteed to have at least 3 more spaces left as 'len >= 61' holds + // here and there is a memcpy of size 'len' below. + LittleEndian::Store32(op, n); + op += count; } memcpy(op, literal, len); return op + len;