Skip to content
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

Hasten macro parsing #68848

Closed

Commits on Feb 10, 2020

  1. Avoid instantiating many Parser structs in generic_extension.

    Currently, every iteration of the main loop in `generic_extension`
    instantiates a `Parser`, which is expensive because `Parser` is a large
    type. Many of those instantiations are only used immutably, particularly
    for simple-but-repetitive macros of the sort seen in `html5ever` and PR
    68836.
    
    This commit initializes a single parser outside the loop, and then uses
    `Cow` to avoid cloning it except for the mutating iterations. This
    speeds up `html5ever` runs by up to 15%.
    nnethercote committed Feb 10, 2020
    Configuration menu
    Copy the full SHA
    67da45f View commit details
    Browse the repository at this point in the history
  2. Remove the Cow from Directory.

    The previous commit wrapped `Parser` within a `Cow` for the hot macro
    parsing path. As a result, there's no need for the `Cow` within
    `Directory`, because it lies within `Parser`.
    nnethercote committed Feb 10, 2020
    Configuration menu
    Copy the full SHA
    63bc4b3 View commit details
    Browse the repository at this point in the history
  3. Change condition ordering in parse_tt.

    This is a small win, because `Failure` is much more common than
    `Success`.
    nnethercote committed Feb 10, 2020
    Configuration menu
    Copy the full SHA
    e6e6bb5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6851f9a View commit details
    Browse the repository at this point in the history