Interesting performance results on Crc port from zlib

Igor stojkovic.igor at gmail.com
Sun Jan 24 15:26:08 UTC 2021


I ported zlib way of CRC calculation [1] to D and then I compared 
its performance to Phobos std.digest.crc and to calling actual 
zlib implementation through etc.c.zlib: crc32_z and I got some 
interesting results:

build type   |  zlib  | phobos | zlibdport |
--------------------------------------------
dmd debug    |  240ms |  272ms |     211ms |
dmd release  |  237ms |  279ms |     202ms |
ldc debug    |  238ms |  136ms |     264ms |
ldc release  |  238ms |  132ms |     125ms |

Calling actual zlib is pretty constant, I guess because it uses 
precompiled static library. What is really surprising is how much 
faster is the port from original zlib. Anyone has any idea how 
can that be?

I tested on:
Operating System: Manjaro Linux
OS Type: 64-bit
Processors: 12 × Intel® Core™ i7-8700K CPU @ 3.70GHz
Memory: 15.6 GiB of RAM

[1] 
https://github.com/madler/zlib/blob/d71dc66fa8a153fb6e7c626847095d9697a6cf42/crc32.c


More information about the Digitalmars-d mailing list