-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Commit a6ff65b
unicode/utf8: make DecodeRune{,InString} inlineable
This change makes the fast path for ASCII characters inlineable in
DecodeRune and DecodeRuneInString. Here are some benchmark results
(no change to allocations):
goos: darwin
goarch: amd64
pkg: unicode/utf8
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
│ old │ new │
│ sec/op │ sec/op vs base │
DecodeASCIIRune-8 2.4545n ± 2% 0.6253n ± 2% -74.52% (p=0.000 n=20)
DecodeJapaneseRune-8 3.988n ± 1% 4.023n ± 1% +0.86% (p=0.050 n=20)
DecodeASCIIRuneInString-8 2.4675n ± 1% 0.6264n ± 2% -74.61% (p=0.000 n=20)
DecodeJapaneseRuneInString-8 3.992n ± 1% 4.001n ± 1% ~ (p=0.625 n=20)
geomean 3.134n 1.585n -49.43%
Note: when #61502 gets resolved, this change should likely be reverted.
Updates #31666
Updates #48195 1 parent bc03e92 commit a6ff65b
File tree
2 files changed
+28
-0
lines changed- src
- cmd/compile/internal/test
- unicode/utf8
2 files changed
+28
-0
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
128 | + | ||
129 | + | ||
128 | 130 |
| |
129 | 131 |
| |
130 | 132 |
| |
|
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
155 | 155 |
| |
156 | 156 |
| |
157 | 157 |
| |
158 | + | ||
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | ||
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | ||
168 | + | ||
169 | + | ||
170 | + | ||
171 | + | ||
158 | 172 |
| |
159 | 173 |
| |
160 | 174 |
| |
| |||
203 | 217 |
| |
204 | 218 |
| |
205 | 219 |
| |
220 | + | ||
221 | + | ||
222 | + | ||
223 | + | ||
224 | + | ||
225 | + | ||
226 | + | ||
227 | + | ||
228 | + | ||
229 | + | ||
230 | + | ||
231 | + | ||
206 | 232 |
| |
207 | 233 |
| |
208 | 234 |
| |
|
0 commit comments