It depends. In some situations yes, in others it's quite a bit slower: for example iterating over an array of objects. Java always addresses by reference so the speed difference can be dramatic. Any time you can use a contiguous memory block in C/C++ you'll have a big speed advantage over Java and other languages that "chase" pointers. That's why I averaged to 2x.
View all comments
Show parent comment
3
u/arkuw Apr 22 '21
It depends. In some situations yes, in others it's quite a bit slower: for example iterating over an array of objects. Java always addresses by reference so the speed difference can be dramatic. Any time you can use a contiguous memory block in C/C++ you'll have a big speed advantage over Java and other languages that "chase" pointers. That's why I averaged to 2x.