Commit 92decdc
net/url: further speed up escape and unescape
This change is a follow-up to CL 712200. It further simplifies and speeds up
functions escape and unescape.
Here are some benchmark results (no change to allocations):
goos: darwin
goarch: amd64
pkg: net/url
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
│ go/src/old │ go/src/new │
│ sec/op │ sec/op vs base │
QueryEscape/#00-8 34.58n ± 1% 31.97n ± 1% -7.55% (p=0.000 n=20)
QueryEscape/#1-8 92.92n ± 0% 94.63n ± 0% +1.84% (p=0.000 n=20)
QueryEscape/#2-8 75.44n ± 0% 73.32n ± 0% -2.80% (p=0.000 n=20)
QueryEscape/#3-8 143.4n ± 0% 136.6n ± 0% -4.71% (p=0.000 n=20)
QueryEscape/golang#4-8 918.8n ± 1% 838.3n ± 0% -8.76% (p=0.000 n=20)
PathEscape/#00-8 43.93n ± 0% 42.86n ± 0% -2.44% (p=0.000 n=20)
PathEscape/#1-8 94.99n ± 0% 95.86n ± 0% +0.91% (p=0.000 n=20)
PathEscape/#2-8 75.40n ± 1% 71.50n ± 1% -5.18% (p=0.000 n=20)
PathEscape/#3-8 143.4n ± 0% 136.2n ± 0% -4.99% (p=0.000 n=20)
PathEscape/golang#4-8 871.8n ± 0% 822.7n ± 0% -5.63% (p=0.000 n=20)
QueryUnescape/#00-8 52.64n ± 1% 51.19n ± 0% -2.75% (p=0.000 n=20)
QueryUnescape/#1-8 137.4n ± 1% 137.9n ± 1% ~ (p=0.297 n=20)
QueryUnescape/#2-8 114.0n ± 0% 122.3n ± 1% +7.24% (p=0.000 n=20)
QueryUnescape/#3-8 271.8n ± 0% 260.7n ± 1% -4.08% (p=0.000 n=20)
QueryUnescape/golang#4-8 1.390µ ± 1% 1.355µ ± 0% -2.52% (p=0.000 n=20)
PathUnescape/#00-8 52.45n ± 1% 53.03n ± 1% +1.10% (p=0.008 n=20)
PathUnescape/#1-8 138.5n ± 1% 141.3n ± 0% +2.06% (p=0.000 n=20)
PathUnescape/#2-8 114.0n ± 0% 121.5n ± 0% +6.62% (p=0.000 n=20)
PathUnescape/#3-8 273.1n ± 1% 260.1n ± 0% -4.76% (p=0.000 n=20)
PathUnescape/golang#4-8 1.431µ ± 1% 1.359µ ± 0% -5.07% (p=0.000 n=20)
geomean 160.4n 156.9n -2.14%
Updates golang#17860
Change-Id: If64ac3e9c62c41f672db06cfd7eab7357e934e6d
GitHub-Last-Rev: 1da047a
GitHub-Pull-Request: golang#76048
Reviewed-on: https://go-review.googlesource.com/c/go/+/714900
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>1 parent 5f4ec35 commit 92decdc
1 file changed
+16
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 61 | + | |
70 | 62 | | |
71 | 63 | | |
72 | 64 | | |
| |||
161 | 153 | | |
162 | 154 | | |
163 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
164 | 163 | | |
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
| 168 | + | |
| 169 | + | |
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 173 | + | |
177 | 174 | | |
178 | 175 | | |
179 | 176 | | |
| |||
195 | 192 | | |
196 | 193 | | |
197 | 194 | | |
198 | | - | |
199 | | - | |
| 195 | + | |
200 | 196 | | |
201 | 197 | | |
202 | 198 | | |
| |||
231 | 227 | | |
232 | 228 | | |
233 | 229 | | |
234 | | - | |
235 | | - | |
| 230 | + | |
| 231 | + | |
236 | 232 | | |
237 | 233 | | |
238 | 234 | | |
| |||
242 | 238 | | |
243 | 239 | | |
244 | 240 | | |
245 | | - | |
| 241 | + | |
246 | 242 | | |
247 | 243 | | |
248 | 244 | | |
| |||
0 commit comments