Re:Why is Rust slightly slower than C?
by pknopf on Wednesday September 11, 2019 @09:37PM
(#20946829)
That isn't "type checking", that is just a guard to prevent simultaneous writes to the same data.
[ Parent
| on HN ]
Re:Why is Rust slightly slower than C?
by jadbox on Wednesday September 11, 2019 @09:52PM
(#20946951)
You're correct- what I had meant to say is Rust is smarter with more runtime checks over C for several cases, like RefCell. Therefor, Rust can be slower than C because of safety (but not because of type checking itself).
Re:Why is Rust slightly slower than C?
by pknopf on Thursday September 12, 2019 @12:07AM
(#20947862)
RefCell has an internal semaphore. It's used specifically for multi threaded scenarios.
If someone is writing a multi threaded C app, they will likely be using semaphores as well. At least, they should be. Rust just enforces it.
So, I wouldn't say rust is "slower" in the regard.
Re:Why is Rust slightly slower than C?
by PrototypeNM1 on Thursday September 12, 2019 @04:12AM
(#20949160)
Iirc RefCell is marked !Sync, I thought Mutex was the multithreadong analog?
Re:Why is Rust slightly slower than C?
by steveklabnik on Thursday September 12, 2019 @08:50AM
(#20950820)
That's correct.