Help optimizing UnCompress for gzipped files

Adam D. Ruppe destructionator at gmail.com
Tue Jan 2 13:57:30 UTC 2018


On Tuesday, 2 January 2018 at 11:22:06 UTC, Stefan Koch wrote:
> You can make it much faster by using a sliced static array as 
> buffer.

Only if you want data corruption! It keeps a copy of your pointer 
internally: 
https://github.com/dlang/phobos/blob/master/std/zlib.d#L605

It also will always overallocate new buffers on each call 
<https://github.com/dlang/phobos/blob/master/std/zlib.d#L602>

There is no efficient way to use it. The implementation is 
substandard because the API limits the design.

If we really want a fast std.zlib, the API will need to be 
extended with new functions to fix these. Those new functions 
will probably look a LOT like the underlying C functions... which 
is why I say just use them right now.

> I suspect that most of the slowdown is caused by the gc.
> As there should be only calls to the gzip library

plz measure before spreading FUD about the GC.


More information about the Digitalmars-d-learn mailing list