Java is Very Fast, If You Don’t Create Many Objects http://blog.vanillajava.blog/2022/09/java-is-very-fast-if-you-dont-create.html
Seriously Java being an Object Oriented Language, literally #YouHadOneJob
> if you want to have write fast java code, you have to code as if you were using C
~a certain minecraft mod developer
@the100rabh Not to apologize for Java, but this article just confirms what's been known in the embedded programming space since basically forever: if you can, avoid dynamic allocations at all costs, and use pools of objects/records of you can't. This isn't just an OO or Java issue, it also affects C/C++, Rust, Modula-2, etc.
@vertigo @the100rabh i think the most interesting thing the article highlights is that the cost isn't going in GC (which is negligible); it's the actual allocation where the time is being spent. which is fascinating, given that the whole raison d'etre of the Azul memory manager is to always do allocation by just incrementing a pointer...
i can only assume that the knock-on effects of continually cycling through new objects are screwing up the cacheing - a new object is necessarily not likely to be in the cache already, and something will have to be evicted to make room for it; whereas if you're reusing an object it's more or less guaranteed to already have booked its space in the cache
This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!