zlib performance

yawniek via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 7 05:29:26 PDT 2015


On Friday, 7 August 2015 at 11:45:00 UTC, Daniel Kozak wrote:
> On Friday, 7 August 2015 at 09:12:32 UTC, yawniek wrote:
>> [...]
>
> Can you try it without write operation (comment out all write)? 
> And than try it without uncompression?
>
>
> // without compression:
>
> void main(string[] args)
> {
>   auto f = File(args[1], "r");
>   foreach (buffer; f.byChunk(4096))
>   {
>           write(cast(char[])buffer);
>   }
> }

  0.03s user 0.09s system 11% cpu 1.046 total


> // without write:
>
> void main(string[] args)
> {
>   auto f = File(args[1], "r");
>   auto uncompressor = new UnCompress(HeaderFormat.gzip);
>
>   foreach (buffer; f.byChunk(4096))
>   {
>           auto uncompressed = 
> cast(char[])(uncompressor.uncompress(buffer));
>   }
>   uncompressor.flush;
> }

2.82s user 0.05s system 99% cpu 2.873 total



More information about the Digitalmars-d-learn mailing list