(Ab)using the refcount for fast circular-reference checking
Discussions on Python.org
(Ab)using the refcount for fast circular-reference checking
I’ve been experimenting with an alternative to the circular-reference tracking used by json. By using a bit in the reference count as a temporary marker, I was able to speed up encoding by roughly 3× in my tests, bringing performance closer to faster alternatives. Here are the benchmark results on Python 3.13.12, Windows x64: encode json jsonyx fastsimdjson msgspec orjson fastest time empty list 10.28x 11.40x 2.26x 2.13x 1.00x 3.38 ns non-empty list 16.59x 5.45x 1.54x 2.00x 1.00x 9.5...
0 comments
No comments yet.