3 ms·
I rewrote a card game engine, openEtG, from JS to Rust. It was a pretty 1:1 rewrite. 2x improvement even when I was using HashMap everywhere. I've since entirel
by __s 4y ago
I rewrote a card game engine, openEtG, from JS to Rust. It was a pretty 1:1 rewrite. 2x improvement even when I was using HashMap everywhere. I've since entirely removed HashMap, which has only further improved perf
As a bonus, the code is now statically typed
- SquareWheel 4y agoI suppose it depends on your use case, but I don't really consider 2x to be a significant difference. Between programming languages we often speak in orders of magnitude. If JS is only half the speed of a compiled language like Rust, that shows remarkably optimized performance.
- Sirened 4y agoTwice as fast is a big deal for damn near any program except like...unimportant, already slow background tasks or things that are already exceptionally fast. Cutting the frame render time in half could give you twice the framerate. Twice the performance on a server could let you handle twice as many concurrent sessions (and possible run half as many servers!). People regularly fight tooth and nail to squeeze 10% performance boosts on critical tasks, doubling it would be incredible
- Dylan16807 4y agoPlenty of game engines are already spending less than a millisecond of CPU time per frame in their own code, so 2x one way or the other makes almost no difference. Things don't need to be "exceptionally" fast to be in the area where programming language doesn't really matter. > Twice the performance on a server could let you handle twice as many concurrent sessions (and possible run half as many servers!) Which might matter, or it might not. Very situational. > People regularly fight tooth and nail to squeeze 10% performance boosts on critical tasks, doubling it would be incredible That kind of task is a small fraction of tasks. And often you're best off using a library, which can often make its own language choices independent of yours.
- shepherdjerred 4y agoJIT/interpreted languages (Java, JS, Python etc.) cannot compete with optimized code from compiled languages. The tradeoff is that Rust is lower-level, so it is harder to write. If performance were the only point of comparison for a language, then we'd all be using assembly. We choose to trade performance for productivity when we're able to.