4 ms·
To practise Rust, I rewrote my small C99 library in it [1]. Performance is more or less the same, I only had to use unchecked array access in one small hot loop
by gattr 6y ago
To practise Rust, I rewrote my small C99 library in it [1]. Performance is more or less the same, I only had to use unchecked array access in one small hot loop (details in README.md). I haven't ported multithreading yet, but I expect Rust's Rayon parallel iterators will likewise be comparable to OpenMP.
[1] https://github.com/GreatAttractor/libskry_r https://github.com/GreatAttractor/libskry_r
- up2isomorphism 6y agoYour C library does not check malloc returns and also malloc and free everywhere inside library functions are not the best way to write a C library.
- gattr 6y agoAs for malloc/free, I'm guessing the recommendation is to allow the user to pass their own allocator on library initialization? Non-checked malloc returns - ouch, I count 12 (out of 56) without a check. Thanks for pointing this out.