Interesting performance results on Crc port from zlib
Steven Schveighoffer
schveiguy at gmail.com
Sun Jan 24 15:47:38 UTC 2021
On 1/24/21 10:26 AM, Igor wrote:
> 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?
Probably inlining. If you are using a compiled library, it can't inline
the code, it has to be an opaque call.
-Steve
More information about the Digitalmars-d
mailing list