-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
Run on PyPy #64
Comments
It looks like lxml have moved their bug tracker to launchpad, can you remember what the lxml issue was @SimonSapin ? |
PyPy developers said on IRC that this bug was on the lxml side. lxml’s developer said he doesn’t care much about PyPy compatibility, because PyPy don’t seem to care much about maintaining cpyext (PyPy’s compatibility layer for C extensions, including anything using Cython like lxml.) PyPy developers say cpyext sucks, and the Right Thing to do is to use CFFI. Someone started porting lxml to CFFI but that doesn’t look very active. (Last commit 10 months ago.) My current plan is to move WeasyPrint away from lxml by using cssselect2 instead of cssselect and thus not rely on lxml’s XPath implementation for Selectors. However, there are still design decisions to make for cssselect2 about what kind of tree it should work on. Ideally, I’d like projects other than WeasyPrint that use cssselect to move to cssselect2, since cssselect is broken in interesting ways because XPath sucks. However yet, I’m working on other things at the moment and not spending much time (if any) on all this. |
I wrote up Kozea/cssselect2#1, in case anyone’s interested. |
I've tested with pypy 5.3.1 and it works very well. lxml now has an "official" support of pypy and everything else is OK, so 🍻. lxml doesn't work (yet) with pypy3 (I've tried 5.2.0-a0), but there should be no problem when an updated version of pypy3 is released. Here's the incredibly-awesomly-reliable benchmark on the whole HTML5 spec (1340 pages PDF generated):
Yay, ≃10% faster! Bonus question: why does pypy generate a 30MB PDF when python's generated PDF is 15MB? I'm soooooo excited, I'd love to spend days and weeks finding why! (Well, my browser can do this in 4.7 seconds including JS, but it doesn't know how to break a table between two pages 😉.) |
Switching to CFFI removed a big obstacle to running WeasyPrint on PyPy. The test suite now actually passes, but bigger document (anything useful) fail because of https://github.com/lxml/lxml/issues/99.
I’m hopeful that PyPy can bring great speed improvements, although there is absolutely no data yet.
The text was updated successfully, but these errors were encountered: