]> Cypherpunks repositories - gostls13.git/commit
internal/bytealg: optimize IndexString on arm64
authorerifan01 <eric.fang@arm.com>
Tue, 17 Apr 2018 07:37:38 +0000 (07:37 +0000)
committerCherry Zhang <cherryyz@google.com>
Tue, 24 Apr 2018 20:21:08 +0000 (20:21 +0000)
commitd4e936cfd622de322dc93f69144c68bb4c133e21
tree4b4fe7a1b9308d7673ae8447c102cb4ef3b67cdc
parent5d4267e4803436e17b87e88b13dc79e528299634
internal/bytealg: optimize IndexString on arm64

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/109015
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/internal/bytealg/index_arm64.s