You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most JSON strings consist solely of ASCII characters that don’t require escaping, so adding a fast path for those would make a big difference. In these cases, we can avoid allocating a new string by writing the original string directly:
PyUnicodeWriter_WriteChar(writer, '"')
PyUnicodeWriter_WriteStr(writer, pystr) // original stringPyUnicodeWriter_WriteChar(writer, '"')
Benchmarks have shown that this roughly 2.2x faster, see PR.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Activity
gh-135336: Add fast path to json string encoding (#133239)
pythongh-135336: Add fast path to json string encoding (python#133239)