Skip to content

Refactor tag searches to use cached parser options #2502

Closed

Description

@jhy

Simplify the HTML tree builder's scope, implied-end-tag, and special-element checks by caching parser-only options on Tag.

Improves HTML parser throughput by about 10% on small inputs and up to about 30% on larger inputs in the benchmark fixtures.

Implemented in 0d2b784

Fixture 1.22.2 ops/s New ops/s Change
tiny 352,173 ± 8,443 359,799 ± 7,241 +2.2%
small 78,866 ± 1,233 86,405 ± 1,191 +9.6%
medium 23,826 ± 94 27,583 ± 642 +15.8%
large 501 ± 13 587 ± 19 +17.1%
x-large 143 ± 3 186 ± 2 +30.3%

(Single threaded comparative throughput.)

Activity

  1. added this to the 1.23.1 milestone on May 12, 2026
  2. added a commit that references this issue on May 12, 2026
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

    improvementAn improvement / new feature idea

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions