Java is Very Fast, If You Don’t Create Many Objects

Seriously Java being an Object Oriented Language, literally #YouHadOneJob

@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

Sign in to participate in the conversation
Dragon Style

I'm a grumpy queer dragon lady and this is my quiet cave for me and some friends.