So I have recently found one space where Java is demonstratively slower than something else (Go Lang). When mapping a file for realtime search, GO is faster and smaller in memory than Java. An extreme edge case, likely something you won't ever need to deal with unless you are attempting to do real time searches on datasets in excess of 100+ million "rows" at high TPS with ultra low latency.
Context: lookups where millisecond to sub-millisecond latencies have actual impact.
This is almost certainly an apples and oranges issue. Any I/O limited workload should have no measurable performance benefits on the language side since the vast majority of time is spent on I/O. I'm fluent in both and I can't think of a reason why a Golang implementation would be faster than Java in any measurable way. Memory consumption is generally lower in Golang of course but that's a win at the expense of more fine grained memory management by developers.
This sounds like there are lots of optimization opportunities in that API. Although part of the problem might be that any data has to be copied to the heap to be accessible for Java code. ByteBuffers can provide limited access to off-heap memory, but retrieving data through these is equivalent to copying data around.
View all comments
Show parent comment
2
u/ai_jarvis Jun 10 '24
So I have recently found one space where Java is demonstratively slower than something else (Go Lang). When mapping a file for realtime search, GO is faster and smaller in memory than Java. An extreme edge case, likely something you won't ever need to deal with unless you are attempting to do real time searches on datasets in excess of 100+ million "rows" at high TPS with ultra low latency.
Context: lookups where millisecond to sub-millisecond latencies have actual impact.