zlib performance

Daniel Kozák via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 7 01:22:49 PDT 2015


On Fri, 07 Aug 2015 08:13:01 +0000
"yawniek" <dlang at srtnwz.com> wrote:

> On Friday, 7 August 2015 at 08:05:01 UTC, Daniel Kozák wrote:
> > import
> >   std.zlib,
> >   std.file,
> >   std.stdio,
> >   std.conv;
> >
> > void main(string[] args)
> > {
> >   auto f = File(args[1], "rb");
> >   auto uncompressor = new UnCompress(HeaderFormat.gzip);
> >
> >   foreach (buffer; f.byChunk(4096))
> >   {
> >           auto uncompressed =
> >   cast(char[])(uncompressor.uncompress(buffer.idup));
> >   write(uncompressed); }
> >   write(cast(char[])uncompressor.flush);
> > }
> >
> > this is faster for me than zcat
> 
> not here on os x:
> d version:  3.06s user 1.17s system 82% cpu 5.156 total
> gzcat   1.79s user 0.11s system 99% cpu 1.899 total

Maybe stil some IO issues. On Linux it is OK. I remmeber a few days ago
there has been some discussion about IO improvments fo osx.

http://forum.dlang.org/post/mailman.184.1437841312.16005.digitalmars-d@puremagic.com



More information about the Digitalmars-d-learn mailing list