Re:Why Is C Faster Than Java (2009)
by JetSetWilly on Monday December 27, 2021 @07:39AM
(#29702011)
I mean, obviously using different languages has different trade offs in many dimensions. If speed were all that mattered then everything would be written in assembler.
But the point at issue is that by using java you are trading off speed (potentially for other benefits).
By the way - tantivy at least is implemented in rust so it shouldn’t suffer from memory safety issues just as lucene shouldn’t. And the rust language will provide some guarantees that java doesn’t - like freedom from data races.
If you replace a more or less safe implementation, with a buggy, memory unsafe C version of it, you are not going to make anyone happy about the performance improvement. Always assuming, that you put in "only" the same amount of time and number of people, not more, than the original implementation.
The amount of things you need to keep in mind with all the memory management and other details when writing C code can also make you blind to other issues like proper input validation and implementation of invariants of application settings. You have to put a lot of energy into making sure you are not leaking memory and avoiding memory safety issues, so you lack that energy when it comes to higher level issues. This is directly affecting developer productivity.