diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-02-05 09:44:03 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-02-06 16:42:53 +1100 |
| commit | 6bf2cc2229768faa8e86e0e8a9f5bd8ebfc817a2 (patch) | |
| tree | f94f68a1b9ff98767712a93772e8919161670f1e /src/test/debuginfo/enum-thinlto.rs | |
| parent | 002287d25f6ef9718dbabd3e23c00b5ebcfb51c1 (diff) | |
| download | rust-6bf2cc2229768faa8e86e0e8a9f5bd8ebfc817a2.tar.gz rust-6bf2cc2229768faa8e86e0e8a9f5bd8ebfc817a2.zip | |
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 "base" 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%.
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
