You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
compiler/natives/src/reflect: Optimize Swapper by swapping JS array elements directly (bypass reflection). (gopherjs#785)
The previous swapper implementation was a very generic one, implemented
using reflection. Since we know the internal GopherJS representation of
a slice, we can implement a much faster swapper that operates on the
underlying JavaScript array directly, bypassing the overhead of the
reflect machinery.
The performance improvement when sorting large slices is extremely high.
benchmark old ns/op new ns/op delta
BenchmarkSortString1K_Slice 17220000 573500 -96.67%
BenchmarkStableInt1K_Slice 82400000 835000 -98.99%
BenchmarkSortInt64K_Slice 2084000000 37533333 -98.20%
0 commit comments