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);
  }
}

Reply via email to