Skip to content

Avoid calling OrderedDict unnecessarily #267

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

Open
gsnedders opened this issue Jun 19, 2016 · 1 comment
Open

Avoid calling OrderedDict unnecessarily #267

gsnedders opened this issue Jun 19, 2016 · 1 comment
Labels

Comments

@gsnedders
Copy link
Member

Making normalizeToken only call OrderedDict when we have more than one attribute leads to a big jump in parsing speed when parsing the HTML spec in some quick testing. Need to make sure we never append to that for it to be a safe optimisation, though.

@gsnedders
Copy link
Member Author

Need to make sure we never append to that for it to be a safe optimisation, though.

We do, and especially with dict by ordered from Python 3.7 (and #493 makes us use it then), the cost here is small. I wonder if special-casing only the zero-attribute case is worth the pain it would cause? And hey, we have benchmarks now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant