Help optimizing UnCompress for gzipped files

Christian Köstlin christian.koestlin at gmail.com
Wed Jan 3 07:57:21 UTC 2018


On 02.01.18 14:51, Adam D. Ruppe wrote:
> On Tuesday, 2 January 2018 at 10:27:11 UTC, Christian Köstlin wrote:
>> After this I analyzed the first step of the process (gunzipping the
>> data from a file to memory), and found out, that dlangs UnCompress is
>> much slower than java, and ruby and plain c.
> 
> Yeah, std.zlib is VERY poorly written. You can get much better
> performance by just calling the C functions yourself instead. (You can
> just import import etc.c.zlib; it is included still)
> 
> Improving it would mean changing the public API. I think the one-shot
> compress/uncompress functions are ok, but the streaming class does a lot
> of unnecessary work inside like copying stuff around.
I added a version that uses the gzip lowlevel apis (similar to my
example c program). I am still having problems copying the data fast
enough to an dlang array.

please see the updated page:
https://github.com/gizmomogwai/benchmarks/tree/master/gunzip

--
Christian Köstlin



More information about the Digitalmars-d-learn mailing list