Commit e32789e
committed
gh-129711: Add a no-escape fast path to the _json str escapers
ascii_escape_unicode() and escape_unicode() now return the input
bulk-copied with surrounding quotes when nothing needs escaping, via a
shared quote_unescaped_unicode() helper, like the writer-based
write_escaped_ascii()/write_escaped_unicode() already do in-place.
This speeds up json.dumps() of clean strings by 1.2x-2.2x. No
behavior change.1 parent 3f99ebe commit e32789e
2 files changed
Lines changed: 31 additions & 0 deletions
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
226 | 248 | | |
227 | 249 | | |
228 | 250 | | |
| |||
236 | 258 | | |
237 | 259 | | |
238 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
239 | 265 | | |
240 | 266 | | |
241 | 267 | | |
| |||
383 | 409 | | |
384 | 410 | | |
385 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
386 | 416 | | |
387 | 417 | | |
388 | 418 | | |
| |||
0 commit comments