News for hackers. Stuff that matters.
Re:Rust is now overall faster than C in benchmarks by tlb on Sunday January 03, 2021 @02:28PM (#25624361)
C++ can inline the comparison function (which is often just a few instructions) at compile time. It can also statically optimize for the stride, using shifts or addressing modes instead of multiplies. C can't do either with qsort, which takes the stride and comparison function pointer as arguments.
Re:Rust is now overall faster than C in benchmarks by makapuf on Sunday January 03, 2021 @06:47PM (#25626422)
Unless comparison function is small and can be inlined, which would trigger the same stride shift optimizations.