zlib performance
Daniel Kozák via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 7 00:29:01 PDT 2015
On Fri, 07 Aug 2015 07:19:43 +0000
yawniek via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:
> hi,
>
> unpacking files is kinda slow, probably i'm doing something wrong.
>
> below code is about half the speed of gnu zcat on my os x machine.
> why?
>
> why do i need to .dup the buffer?
> can i get rid of the casts?
>
>
> the chunk size has only a marginal influence.
> https://github.com/yannick/zcatd
>
> import
> std.zlib,
> std.file,
> std.stdio;
>
> void main(string[] args)
> {
> auto f = File(args[1], "r");
> auto uncompressor = new UnCompress(HeaderFormat.gzip);
>
> foreach (ubyte[] buffer; f.byChunk(4096))
> {
> auto uncompressed = cast(immutable(string))
> uncompressor.uncompress(buffer.dup);
> write(uncompressed);
> }
> }
Which compiler and version. There has been some performance problem
with IO on OSX, it should be fixed in 2.068 release
More information about the Digitalmars-d-learn
mailing list