- Notifications
You must be signed in to change notification settings - Fork294
Constant phases#567
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Constant phases#567
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This added a fair bit of complexity, and notable made the Phase classesdynamically generated.However, by doing this, we no longer include "process thetoken using the rules for" phases in the debug log.
When looking at the PR without whitespace changes, it's not that complicated. All tests pass, no performance regression. I think this should go in as is. This will help us optimize, whether with Cython or with mypyc, as the result is a plain old |
@@ -204,6 +191,9 @@ def mainLoop(self): | |||
DoctypeToken = tokenTypes["Doctype"] | |||
ParseErrorToken = tokenTypes["ParseError"] | |||
type_names = {value: key for key, value in tokenTypes.items()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I suppose one could skip computing this unlessdebug
is set, but probably not worthwhile.
This is#272 but rebased on top of current master.
I made cursory benchmarking of this and I see no difference between master and this branch.
Each timing is geomean from 30 runs. This is executed on Homebrew builds of all Pythons above on an M1 Max Macbook Pro. The slow result from pypy3 (v7.3.9) is because it's running in Rosetta (x86-64 emulation). The important thing is to compare the time on the PR with the time on master.