Help optimizing UnCompress for gzipped files

Christian Köstlin christian.koestlin at gmail.com
Thu Jan 4 18:57:47 UTC 2018


On 04.01.18 16:53, Steven Schveighoffer wrote:
> 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).
Thanks Steve,
this runs now faster, I will update the table.

Sorry, but I do not get how to cleanup the mallocated memory :)
Could you help me out here?

--
Christian Köstlin


More information about the Digitalmars-d-learn mailing list