zlib performance
yawniek via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 7 01:13:01 PDT 2015
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
More information about the Digitalmars-d-learn
mailing list