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
JSON encoder (PyUnicodeWriter is used already for the decoder)
StringIO (very minimal use of PyAccu)
The newer PyUnicodeWriter seems to be a better tool for aggregating strings and removing PyAccu gets rid of >100 lines of C code while keeping the same functionality.
P.S. The new JSON encoder also performed ~10% better on a completely synthetic test encoding a 20Mb JSON. That JSON in turn was created while investigating the lack of concurrent execution in FastAPI services. Which turned out to be due to JSON encoding.
pyperformance has some JSON-related benchmarks. It would be good to run those in our stable benchmarking environment to confirm the performance increase before merging. I'm happy to do that if you ping me when your PR is ready for that testing.
Activity
mdboom commentedon Jul 19, 2022
pyperformance has some JSON-related benchmarks. It would be good to run those in our stable benchmarking environment to confirm the performance increase before merging. I'm happy to do that if you ping me when your PR is ready for that testing.
aivarsk commentedon Jul 19, 2022
This is pyperformance before my changes:
And after my changes:
There is an improvement but not as big as in my 20Mb test case.
aivarsk commentedon Jul 19, 2022
@mdboom the PR is ready, can you run the tests?
mdboom commentedon Jul 19, 2022
The results on the standard test machine corroborate your results.
Before your change:
After your change:
So, a solid improvement (and of course there are other reasons to do this besides just performance...)
gh-95005: Replace PyAccu with PyUnicodeWriter (gh-95006)