Skip to content

Avoid calling OrderedDict unnecessarily #267

Open

Description

@gsnedders

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.

Activity

  1. gsnedders commented on Jun 10, 2020

    @gsnedders
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions