Hacker News new | ask | show | jobs
by gigatexal 3397 days ago
The rust version is using multiple cpus using a pool concept (which looks a lot like the multiprocessing module from python so kudos there). But the C version is single threaded from what I can tell. So rust is safe but threaded to be faster than single threaded C which isn't that much slower. Hmm...
3 comments

That's not true. If you look at the comparisons, the cpu time taken by C is actually more than rust, and the cpu load looks about even. Note the C version uses:

    #pragma omp parallel sections
Ahh dang I didn't know you could do compiler run parallelism.
>.. and the cpu load looks about even.

318% is 20% bigger then 265%.

And 5.30s is about 20% faster than 6.46s. We're just throwing around numbers now.

My point was that the cpu load is "about even" compared to if the C version was single-threaded, in which case it would look more like 200-300% bigger cpu load instead of merely 20%.

From what I can see the C version is using OpenMP and uses all of the available CPU cores.
Is the C version optimized? Could you conclude that parallelism in rust is faster/ better than C + openMP in this case considering rust is to replace C++ and is safe at least in this submission?
Yeah I see that now. Missed that; my mistake.
Isn't the whole point of Rust to do threaded things safely by keeping strict tabs on who owns what and for how long?