mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 00:47:56 +01:00
Implement std/crc32 ieee_hasher.up_x86_sse42
On a mid-range x86_64 laptop:
----
$ ls -lh linux-5.11.3.tar.gz | awk '{print $5 " " $9}'
178M linux-5.11.3.tar.gz
$ # Debian's /usr/bin/crc32
$ time /usr/bin/crc32 /dev/stdin < linux-5.11.3.tar.gz > /dev/null
real 0m0.411s
$ # Wuffs; before
$ time gen/bin/example-crc32 < linux-5.11.3.tar.gz > /dev/null
real 0m0.137s
$ # Wuffs; after
$ time gen/bin/example-crc32 < linux-5.11.3.tar.gz > /dev/null
real 0m0.060s
----
Wuffs benchmarks:
wuffs_crc32_ieee_10k/clang9 1.71GB/s ± 0% 8.40GB/s ± 3% +391.97% (p=0.008 n=5+5)
wuffs_crc32_ieee_100k/clang9 1.73GB/s ± 1% 10.67GB/s ± 0% +518.47% (p=0.008 n=5+5)
wuffs_crc32_ieee_10k/gcc10 2.08GB/s ± 0% 8.77GB/s ± 0% +322.05% (p=0.008 n=5+5)
wuffs_crc32_ieee_100k/gcc10 2.10GB/s ± 0% 11.23GB/s ± 0% +435.56% (p=0.008 n=5+5)
mimic_crc32_ieee_10k 774MB/s ± 0% 776MB/s ± 0% +0.23% (p=0.016 n=5+5)
mimic_crc32_ieee_100k 773MB/s ± 0% 775MB/s ± 0% +0.24% (p=0.032 n=5+5)
wuffs_gzip_decode_10k/clang9 151MB/s ± 0% 166MB/s ± 0% +9.81% (p=0.008 n=5+5)
wuffs_gzip_decode_100k/clang9 155MB/s ± 0% 178MB/s ± 0% +14.53% (p=0.008 n=5+5)
wuffs_gzip_decode_10k/gcc10 150MB/s ± 0% 172MB/s ± 0% +14.92% (p=0.008 n=5+5)
wuffs_gzip_decode_100k/gcc10 188MB/s ± 0% 198MB/s ± 0% +5.37% (p=0.008 n=5+5)
mimic_gzip_decode_10k 121MB/s ± 0% 121MB/s ± 0% ~ (p=1.000 n=5+5)
mimic_gzip_decode_100k 143MB/s ± 0% 144MB/s ± 0% ~ (p=0.056 n=5+5)
wuffs_png_decode_image_19k_8bpp/clang9 111MB/s ± 0% 115MB/s ± 0% +3.77% (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang9 147MB/s ± 0% 153MB/s ± 0% +4.66% (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang9 404MB/s ± 0% 415MB/s ± 0% +2.75% (p=0.016 n=5+4)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9 344MB/s ± 0% 345MB/s ± 1% ~ (p=0.151 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9 329MB/s ± 0% 335MB/s ± 0% +1.78% (p=0.016 n=5+4)
wuffs_png_decode_image_4002k_24bpp/clang9 148MB/s ± 0% 153MB/s ± 0% +3.38% (p=0.008 n=5+5)
wuffs_png_decode_image_19k_8bpp/gcc10 120MB/s ± 0% 123MB/s ± 0% +2.62% (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10 153MB/s ± 0% 159MB/s ± 1% +3.54% (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc10 440MB/s ± 0% 452MB/s ± 0% +2.82% (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10 357MB/s ± 0% 353MB/s ± 0% -0.95% (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10 341MB/s ± 0% 341MB/s ± 0% ~ (p=0.151 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10 157MB/s ± 0% 161MB/s ± 0% +2.85% (p=0.016 n=5+4)
mimic_png_decode_image_19k_8bpp 58.1MB/s ± 0% 58.1MB/s ± 0% ~ (p=0.389 n=5+5)
mimic_png_decode_image_40k_24bpp 73.2MB/s ± 0% 73.2MB/s ± 0% ~ (p=0.548 n=5+5)
mimic_png_decode_image_77k_8bpp 177MB/s ± 0% 177MB/s ± 0% +0.14% (p=0.008 n=5+5)
mimic_png_decode_image_552k_32bpp_ignore_checksum skipped
mimic_png_decode_image_552k_32bpp_verify_checksum 146MB/s ± 0% 147MB/s ± 0% +0.13% (p=0.016 n=5+5)
mimic_png_decode_image_4002k_24bpp 104MB/s ± 0% 104MB/s ± 0% ~ (p=0.556 n=5+4)
This commit is contained in:
1 parent
44acd0e20a
commit
5d4fbc3ac6
6 files changed
+239
-25
No files matched your search
+7
-8
@@ -78,10 +78,11 @@ polynomial is `N=4, LSB, BITS=0xC`. If `N` and `LSB`-ness is agreed beforehand,
|
||||
`0xC` is all you need to specify the polynomial.
|
||||
|
||||
For 32 bit CRCs, the two popular polynomials (presented in `LSB` order) are
|
||||
`0xEDB88320` and `0x82F63B78`, also called the IEEE and Castagnoli polynomials,
|
||||
also called CRC-32 and CRC-32C. For example, the bit string representation of
|
||||
the IEEE polynomial `0xEDB88320`, un-reversed and with the implicit high bit,
|
||||
is `0b1_00000100_11000001_00011101_10110111`.
|
||||
`0xEDB8_8320` and `0x82F6_3B78`, also called the IEEE and Castagnoli
|
||||
polynomials, also called CRC-32 and CRC-32C. For example, the bit string
|
||||
representation of the IEEE polynomial `0xEDB8_8320`, un-reversed and with the
|
||||
implicit high bit, is `0b1_00000100_11000001_00011101_10110111 =
|
||||
0x1_04C1_1DB7`.
|
||||
|
||||
|
||||
# Worked Example
|
||||
@@ -138,8 +139,8 @@ invert 01011001 00111100 01000100 10101011
|
||||
hex A 9 C 3 2 2 5 D
|
||||
```
|
||||
|
||||
The final line says that the CRC-32 checksum of "Hi\n" is 0xD5223C9A. This can
|
||||
be verified by running the `/usr/bin/crc32` program:
|
||||
The final line says that the CRC-32 checksum of "Hi\n" is `0xD522_3C9A`. This
|
||||
can be verified by running the `/usr/bin/crc32` program:
|
||||
|
||||
```
|
||||
$ echo Hi | xxd /dev/stdin
|
||||
@@ -226,8 +227,6 @@ Instruction](https://www.intel.com/content/dam/www/public/us/en/documents/white-
|
||||
by Gopal, Ozturk, Guilford, Wolrich, Feghali and Dixon of Intel Corporation and
|
||||
Karakoyunlu of the Worcester Polytechnic Institute.
|
||||
|
||||
Wuffs does not currently implement the SIMD algorithm.
|
||||
|
||||
|
||||
# Further Reading
|
||||
|
||||
|
||||
Reference in new issue
Block a user