Avoiding the garbage collector
D programs typically use a garbage collector that can make memory management both easier and more efficient. With the garbage collector, you don't have to keep track of object ownership and can defer free memory to a later point, which can boost performance.
However, while the garbage collector is useful, it doesn't absolve you of all thought in the area of memory management, especially when performance is important. In tight loops, you'll want to avoid the garbage collector. The way to do this is to avoid garbage collection allocations. No garbage collection allocation means no garbage collection cycle.
How to do it…
In order to avoid the garbage collector, perform the following steps:
Find the hotspots in your application. Typically, this means focusing on your innermost loops.
Remove functions and operations that call into the GC:
Array literals, except the ones initializing a variable marked static
Array append or concatenation
Array length assignment
Any associative...