Alex Rosen wrote:
>> > especially since object creation overhead
> > is pretty low for Hot Spot JVMs.
>> Really? I was under the impression that object creation (plus the extra GC
> work that it will cause later on) is one of the slowest things a VM can do,
> even for HotSpot. I could imagine that it might be slower than accessing a
> linked list using an index, but I didn't think that it was "pretty low"
> overhead, I thought it was just the opposite.
The layman's understanding I have of it is that HotSpot uses an "object
nursery" for new objects (think a block of reserved memory) and only
when the object lives through one full cycle of the nursery is it moved
to the real heap. Since you don't get direct pointers in Java this is
conveniently possible. Turns out to be far faster than malloc() in C.
You'd have to do your own pooling in C to match it.
-jh-