aboutsummaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2017-07-21 16:42:14 +0300
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2017-07-21 16:42:32 +0300
commit6ece3d93593b302a72de10ddb6fbd1f21f008d90 (patch)
tree3e5e0d66d7946ca14824f967084fcf74b8ffa296 /args.go
parentioptimized decodeArgAppend a bit (diff)
downloadfasthttp-6ece3d93593b302a72de10ddb6fbd1f21f008d90.tar.gz
fasthttp-6ece3d93593b302a72de10ddb6fbd1f21f008d90.tar.bz2
fasthttp-6ece3d93593b302a72de10ddb6fbd1f21f008d90.zip
decodeArgAppend* optimization: remove bounds check when decoding percent-encoded string
Benchmark results: name old time/op new time/op delta AppendUnquotedArgSlowPath-4 68.9ns ± 2% 63.5ns ± 2% -7.88% (p=0.000 n=10+10)
Diffstat (limited to 'args.go')
-rw-r--r--args.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/args.go b/args.go
index 514d51d..c2974be 100644
--- a/args.go
+++ b/args.go
@@ -466,8 +466,8 @@ func decodeArgAppend(dst, src []byte) []byte {
if i+2 >= n {
return append(dst, src[i:]...)
}
- x1 := hex2intTable[src[i+1]]
x2 := hex2intTable[src[i+2]]
+ x1 := hex2intTable[src[i+1]]
if x1 == 16 || x2 == 16 {
dst = append(dst, c)
} else {
@@ -501,8 +501,8 @@ func decodeArgAppendNoPlus(dst, src []byte) []byte {
if i+2 >= n {
return append(dst, src[i:]...)
}
- x1 := hex2intTable[src[i+1]]
x2 := hex2intTable[src[i+2]]
+ x1 := hex2intTable[src[i+1]]
if x1 == 16 || x2 == 16 {
dst = append(dst, c)
} else {