Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Speedup coins.Sort() when coins is of length 1
Coins.Sort() performs a heap allocation, even though sort.Sort() is in place. This is because the compiler is doing {something} called runtime.convTSlice which internally makes a copy of the entire slice. We should ideally find a solution that avoids this malloc for every Coins.Sort() of all sizes, but just eliminating it for slices of length <= 1 is already a big win, as Sort's are used throughout the Add and Sub logic.
- Loading branch information