-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is the yajl_c backend supported on PyPy? #82
Comments
@jpmckinney all good questions! So:
|
Thanks! That jogged my memory a bit – I do something unusual in my code, where I build a dict in which some values are generators. I then use this code when I need to serialize the dict to JSON. Somewhere in there, the combination of generators and ijson caused a C error. Anyway, I'm trying to reproduce it now, but I can't get pip to find YAJL headers when using PyPy (I can use the yajl_c backend in CPython, but I think it's included in the wheel). |
That's interesting about the backends available to you. I just double-checked one the latest I published just the other day for ijson 3.2.0 under https://pypi.org/project/ijson/#files (pypy39, manylinux, x86_64) and it contained both the compiled yajl library and the yajl2_c backends. I also gave it a quick wirl:
Boom! And as a tiny benchmark:
So cffi seems to be the winner in this case. It'd be good to see more evidence that gives these backends a natural sorting order in which we can recommend them under pypy. For reference, this is the same benchmark with CPython 3.10:
|
Ah, I'm on macos arm64, so that might be the reason – there's no arm 64 wheel for PyPy on macos. So it looks like on PyPy (on that benchmark): _cffi > python > yajl2 > _c. That said, yajl_c on CPython seems fastest all around. |
Yes, that seems to be more or less the order. Still I'd hesitate to make a decision based on those alone; if you (or someone else) could provide more real-life numbers it'd be great -- things might be different on a macos arm64 for example. |
I probably won't be able to, as I can't figure out how to make ijson find YAJL headers on PyPy. Feel free to close the issue. |
OK, thanks for the feedback! I'll close this now, but this issue should be a good reference for future PyPy users. |
I think yajl2_cffi worked for me, last time I tested, but yajl_c was causing C errors.
The docs mention "python: pure Python parser, good to use with PyPy"
Do you happen to know the difference in performance between a YAJL and pure-Python backend when using PyPy?
Also, should the backend selection code use different options/ordering on PyPy?
ijson/ijson/__init__.py
Line 30 in a62c4b3
The text was updated successfully, but these errors were encountered: