Description
...but not when targeting native code.
I am very confused.
My naive Quicksort outperforms them both by a couple orders of magnitude(!!!!!) regardless which browser it is executed in (which tells me this is a Rust/LLVM issue, not wasm engine issue). This Quicksort is very naive: it is not pattern defeating, nor optimistically using insertion sort for small and mostly sorted ranges, or any of the other things that the built-in sort is doing.
https://github.com/fitzgen/source-map-mappings/blob/master/src/sort.rs
In fact, just replacing the custom swap
routine with core
's slice::swap
causes a huge slow down. Again, only with wasm, not native code. That makes no sense to me.
-
Why is this particular performance gap occurring?
-
In the more general case, how do we debug and profile these cases where
perf(wasm) != perf(native)
and seemingly irrelevant changes have large effects on performance?
(I guess the first thing to do in this particular case is diff the disassembly and see how the emitted code differs? What other techniques do we have?)