diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2017-07-21 16:42:14 +0300 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2017-07-21 16:42:32 +0300 |
commit | 6ece3d93593b302a72de10ddb6fbd1f21f008d90 (patch) | |
tree | 3e5e0d66d7946ca14824f967084fcf74b8ffa296 /args.go | |
parent | ioptimized decodeArgAppend a bit (diff) | |
download | fasthttp-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.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 { |