Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make .sort about 4.4x as fast on Int/Str/Num arrays
AlexDaniel++ expressed concern about the Junction check causing a slow down in sorting. And he was right. However, when looking at the profile, it occurred to me that most of the overhead of sorting was caused by using the default infix:<cmp> logic. With the multi sub "compare" now inbetween, it was possible to turn this overhead into a feature by adding additional candidates for Int/Str/Num and their allomorph counterparts, and just having the nqp::cmp_x in there. This basically made this benchmark: my @A = ^1000 .reverse; for ^100 { @a.sort } go 4.4x as fast, mostly caused by the fact that the code went down from 12 GC's to 0, and of course one less sub to be called, and no coercion from Order to int being necessary anymore.
- Loading branch information