by array_key_first · 9mo ago · 0 comments
Garbage collectors also use similar strategies. Collecting garbage is expensive, so just don't until you need to. The extra memory usage in this case isn't a downside, it's an upside. Your code runs faster.
That's how Java and dotnet are able to achieve insane performance times in some benchmarks, like within 50% of native. They're not collecting garbage, and their allocators are actually faster than malloc.
If you've ever run a Java program at consistent 90% heap usage, you'll notice it absolutely grinds to a halt. I'm talking orders of magnitude slower. Naturally, this isnt highlighted in benchmarks, but it illustrates the power of allocating more memory.
No comments yet.