On Friday, 15 January 2021 at 07:35:00 UTC, H. S. Teoh wrote:
(1) Refactored one function called from an inner loop to reuse
a buffer instead of allocating a new one each time, thus
eliminating a large amount of garbage from small allocations;
<...>
The result was about 40-50% reduction in runtime, which is
close to about a 2x speedup.
I think this message needs to be signal boosted. Most of the time
GC is not the problem. The problem is sloppy memory usage. If you
allocate a lot of temporary objects your performance will suffer
even if you use malloc and free. If you write code that tries to
use stack allocation as much as possible, doesn't copy data
around, reuses buffers then it will be faster than manual memory
management that doesn't do that. And thats with a "slow" GC.