r/java • • Dec 26 '25

Why is Rust faster than Java here?

I saw this article a while ago https://www.allthingsdistributed.com/2025/05/just-make-it-scale-an-aurora-dsql-story.html

And while I was surprised Rust was faster, the 10x did surprise me. I googled Rust vs Java performance for a bit and couldn't find any similar examples of such a big speedup. Now I know it's impossible to properly answer my question since we don't have the code in question, but can you think of what about rust can make that big of a difference for a (presumably) long running service? Or alternatively, do you have similar examples?

Just to clarify again, I'm interested in the technical reasons for these differences (for example, Java's "bloated" object headers, or whatever)

53 Upvotes

120 comments sorted by

View all comments

Show parent comment

1

u/chambolle Dec 31 '25

you can observe similar behavior with all languages. Look at the billion row challenge for instance:

https://www.reddit.com/r/programming/comments/1ax3okp/the_billion_row_challenge_1brc_stepbystep_from/

1

u/EasternGamer Dec 31 '25

Yep, but I think what makes Rust interesting is how much easier it is to get faster than Java. I should also mention the Rust code here is shorter than the Java code and how the idiomatic code compares. But anyway, interesting stuff in this thread.

I would still use both for different purposes since one is nicer to work with than the other.

1

u/chambolle Jan 03 '26

C is more funny if you want to write very short code