3 ms·
How much slower would Rust be? If C++ delivers 4us and Java delivers 25us tick to trade for a particular strategy (say, book building, some calculations, then o
by hackerlight 4y ago
How much slower would Rust be? If C++ delivers 4us and Java delivers 25us tick to trade for a particular strategy (say, book building, some calculations, then order sending), what could Rust get?
- fwsgonzo 4y agoThere's some extra checks, which are usually branches, so I would guess that the branch predictor gets a little bit more pressured, while also taking a few extra cycles in the branches. But, I think you can still create fast happy paths with Rust just like other languages.
- WiSaGaN 4y agoTheoretically, Rust can be as fast as C/C++ as long as you dive into unsafe when necessary, or skip string like UTF-8 string. However, a lot of the upside for using Rust will be gone as well, which will not make using Rust as compelling as in other domains. And when using Rust, people will probably incline to use more idiomatic Rust, which will be a bit slower. Thus I would say you would expect the actual Rust code you see will be to around 6us in scale, that is, a bit slower but still comparable to C/C++, at the same time with much better robustness (much fewer crashes).