2 ms·
Even without value types, Java/C# can do probably much better on the pointer vector case than C++, thanks to allocation from contiguous region and automatic mem
by pkolaczk 12y ago
Even without value types, Java/C# can do probably much better on the pointer vector case than C++, thanks to allocation from contiguous region and automatic memory defragmentation. It is very likely all the objects referenced from the vector would be placed in a contiguous memory region which is easy to prefetch for the CPU (sure, still not as fast as inlining them into array). This is completely different than in C++ where subsequent dynamic allocations return pointers scattered around the whole heap, especially after long run.