• erifan01's avatar
    internal/bytealg: optimize IndexString on arm64 · d4e936cf
    erifan01 authored
    This CL adjusts the order of the branch instructions of the
    code to make it easier for the LIKELY branch to happen.
    
    Benchmarks:
    name                            old time/op    new time/op    delta
    pkg:strings goos:linux goarch:arm64
    IndexHard2-8                      2.17ms ± 1%    1.23ms ± 0%  -43.34%  (p=0.008 n=5+5)
    CountHard2-8                      2.13ms ± 1%    1.21ms ± 2%  -43.31%  (p=0.008 n=5+5)
    
    pkg:bytes goos:linux goarch:arm64
    IndexRune/4M-8                     661µs ±22%     513µs ± 0%  -22.32%  (p=0.008 n=5+5)
    IndexEasy/4M-8                     672µs ±23%     513µs ± 0%  -23.71%  (p=0.016 n=5+4)
    
    Change-Id: Ib96f095edf77747edc8a971e79f5c1428e5808ce
    Reviewed-on: https://go-review.googlesource.com/109015Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    d4e936cf
Name
Last commit
Last update
..
bytealg.go Loading commit data...
compare_386.s Loading commit data...
compare_amd64.s Loading commit data...
compare_amd64p32.s Loading commit data...
compare_arm.s Loading commit data...
compare_arm64.s Loading commit data...
compare_generic.go Loading commit data...
compare_mipsx.s Loading commit data...
compare_native.go Loading commit data...
compare_ppc64x.s Loading commit data...
compare_s390x.s Loading commit data...
count_amd64.s Loading commit data...
count_arm64.s Loading commit data...
count_generic.go Loading commit data...
count_native.go Loading commit data...
equal_386.s Loading commit data...
equal_amd64.s Loading commit data...
equal_amd64p32.s Loading commit data...
equal_arm.s Loading commit data...
equal_arm64.s Loading commit data...
equal_mips64x.s Loading commit data...
equal_mipsx.s Loading commit data...
equal_native.go Loading commit data...
equal_ppc64x.s Loading commit data...
equal_s390x.s Loading commit data...
index_amd64.go Loading commit data...
index_amd64.s Loading commit data...
index_arm64.go Loading commit data...
index_arm64.s Loading commit data...
index_generic.go Loading commit data...
index_native.go Loading commit data...
index_s390x.go Loading commit data...
index_s390x.s Loading commit data...
indexbyte_386.s Loading commit data...
indexbyte_amd64.s Loading commit data...
indexbyte_amd64p32.s Loading commit data...
indexbyte_arm.s Loading commit data...
indexbyte_arm64.s Loading commit data...
indexbyte_generic.go Loading commit data...
indexbyte_mips64x.s Loading commit data...
indexbyte_mipsx.s Loading commit data...
indexbyte_native.go Loading commit data...
indexbyte_ppc64x.s Loading commit data...
indexbyte_s390x.s Loading commit data...