Hacker News new | ask | show | jobs
by iso8859-1 3884 days ago
Do you think it would be possible to write the original game in mostly safe Rust with no performance hit?
2 comments

No perceptible performance hit on a modern machine? Absolutely. I'm sure you can run 100 copies of Doom simultaneously in Javascript or whatever.

No perceptible performance hit on a 486? Somehow, I don't think that the 486 is an especially important target for the LLVM or Rust developers (though such chips are used in embedded applications to this day).

But the real reason that the comparison makes no sense is that the bulk of the processing time (but not the bulk of the code, mind you) is spent in those tightly optimized assembly loops. Either you keep it as such and it's not really much of a battle between C and Rust any more, or you rewrite the critical sections in Rust and you'd lose as hard or more as if you wrote them in C.

Weirdly the i586 is the problematic one. 3, 4, 6, 7, and 8 all apparently work fine.

https://users.rust-lang.org/t/i586-support-illegal-hardware-...

That bug just looks like a glitch with ISA support in the generated code. It's trivially fixable I'm sure, and not really relevant to the subject of optimized assembly.
There would most definitely be a performance hit, but you would notice.
Even if the new code made itself amenable to those nice vector units in modern CPUs?