Really easy optimization with std.experimental.allocator
Dicebot via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 7 06:16:03 PST 2017
On Sunday, 18 September 2016 at 01:44:10 UTC, Ryan wrote:
> I think it works because each time you call dispose it tells
> the GC to mark that memory as available, without the GC needing
> to do a collection sweep. This could be a really useful tip in
> the allocators section, as I see converting to IAllocator with
> the GC as the first step in testing optimizations with
> allocators.
A bit more than that - because you dispose and allocate same
amount of memory, you effectively reuse same memory block in GC
pools over and over again. It is hardly surprising that this is
much faster than "honest" allocation of lot of memory across
different pools (CPU memory cache access pattern alone will make
a huge difference).
More information about the Digitalmars-d-learn
mailing list