3 ms·
What are we looking for in the qsort example? Is there a Rust equivalent we should compare to?
by Bromskloss 10y ago
What are we looking for in the qsort example? Is there a Rust equivalent we should compare to?
- dbaupp 10y agoThe C code is forced to use a function pointer and hence do dynamic virtual calls for each comparison, while Rust and C++ can use generics/templates to get static dispatch (and hence inlining, constant folding etc.). You can see C vs. C++ in http://www.martin-ueding.de/en/programming/qsort/index.html http://www.martin-ueding.de/en/programming/qsort/index.html , and Rust is likely to be similar to C++.
- nwmcsween 10y agoLTO will allow qsort to be inlined, etc.