Help optimizing UnCompress for gzipped files
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jan 4 15:53:37 UTC 2018
On 1/3/18 3:28 PM, Steven Schveighoffer wrote:
> Stay tuned, there will be updates to iopipe to hopefully make it as fast
> in this microbenchmark as the C version :)
v0.0.3 has been released. To take advantage of using malloc/realloc, you
can use std.experimental.allocator.mallocator.Mallocator as the
BufferManager's allocator.
e.g.:
auto myPipe = openDev("file.gz").bufd // not here
.unzip!Mallocator; // here
myPipe.ensureElems(); // this works now.
auto bytesRead = myPipe.window.length;
The reason you don't need it on the first bufd is because that is the
buffer of the file stream, which isn't going to grow.
Note: the buffer manager does not free the data on destruction! You are
responsible for freeing it (if you use Mallocator).
-Steve
More information about the Digitalmars-d-learn
mailing list