zlib performance

Daniel Kozák via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 7 01:24:11 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

can you try it with ldc?

ldc[2] -O -release -boundscheck=off -singleobj  app.d



More information about the Digitalmars-d-learn mailing list