|
|
|
|
|
by nostrademons
3885 days ago
|
|
There's still a pretty big speed penalty for Java because the object model encourages a lot of pointer-chasing, which will blow your data locality. In C++, it's common for contained structs to be flat in memory, so accessing a data member in them is just an offset from a base address. In Java, all Object types are really pointers, which you need to dereference to get the contained object. HotSpot can't really optimize this beyond putting really frequently used objects in registers. A lot of big-data work involves pulling out struct fields from a deeply nested composite record, and then performing some manipulation on them. |
|
50x is not unreasonable for C/C++ code that was OO and uses a data oriented approach instead.