-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Commit d205438
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.4585n ± 1% 0.6187n ± 1% -74.83% (p=0.000 n=20)
DecodeJapaneseRune-8 3.987n ± 1% 3.984n ± 1% ~ (p=0.941 n=20)
DecodeASCIIRuneInString-8 2.2945n ± 1% 0.3123n ± 2% -86.39% (p=0.000 n=20)
DecodeJapaneseRuneInString-8 3.821n ± 1% 3.983n ± 1% +4.25% (p=0.000 n=20)
geomean 3.045n 1.323n -56.53%
Note: when #61502 gets resolved, this change should likely be reverted.
Updates #48195 1 parent d029eaa commit d205438
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