mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: faster string equality.
benchmark old ns/op new ns/op delta BenchmarkCompareStringEqual 51 35 -30.20% BenchmarkCompareStringIdentical 51 7 -85.71% BenchmarkCompareStringSameLength 25 18 -28.29% BenchmarkCompareStringDifferentLength 2 2 +1.46% R=golang-dev, rsc CC=golang-dev, remy https://golang.org/cl/6450092
This commit is contained in:
parent
ab058b3540
commit
77f3e189d2
6 changed files with 89 additions and 11 deletions
|
|
@ -324,6 +324,10 @@ runtime·strequal(bool *eq, uintptr s, void *a, void *b)
|
|||
*eq = false;
|
||||
return;
|
||||
}
|
||||
if(((String*)a)->str == ((String*)b)->str) {
|
||||
*eq = true;
|
||||
return;
|
||||
}
|
||||
runtime·memequal(eq, alen, ((String*)a)->str, ((String*)b)->str);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue