Hi,
I'm dealing with a performance issue in java where it appears that
performance is noticably affected by the fact that many (thousands) of
relatively small objects need to be created very quickly (multiple small
memory allocations). From my C/C++ background I would have considered
solving this problem by allocating the objects in reasonable sized blocks
of objects (single alloc for many objects to minimize system calls).
Individual objects could still be accessed (perhaps
calloc/sizeof/typecast) and could then continue to be referenced in the
normal way (hashtables, vectors, trees, etc).
However, I do not see any obvious way to achieve this in java. You cannot
simply allocate a chunk of memory (you also cannot know the object size,
or typecaste the memory to the object type). If I allocate an array of
objects, I'm simply allocating an array object that contains references to
the correct object type, but does not actually contain those objects, and
they still need to be created.
Does anyone know of a good way to solve this problem? Any suggestions
around the issue of object creation performance are welcome.
Cheers, Craig
------
"I like to believe that people in the long run are going to do more to
promote peace than our governments. Indeed, I think that people want
peace so much that one of these days governments had better get out of
the way and let them have it."
-- Dwight D. Eisenhower
======================================================================
Craig Taverner ------====== Email:[EMAIL PROTECTED]
ComOpt AB ------======== Tel: +46-42-212580
Michael Löfmans Gata 6 ------========== Fax: +46-42-210585
SE-254 38 Helsingborg ------======== Cell: +46-708-212598
Sweden ------====== http://www.comopt.com
======================================================================