Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The initial implementation assumed that PolicyParser::new() was a relatively cheap function time-wise, and called it once per file. There's no need to rebuild it, and it turns out in lalrpop performance discussions that new() can actually be expensive (and possible performance improvements could move work into new() to speed up the steady state).
Regardless of the significance, there's no real cost to pulling new() out to call once per file (although it might complicate the API ever so slightly if we later expose parse_policy() as a public function.)
The benchmark run is below. The weird thing is that Stress Functions only has one file, so I would expect this to be a no-op for performance there. But that 14% has been pretty reproducible across multiple runs. I'm not really sure what's going on there.
Full system compile time: [6.1514 ms 6.2534 ms 6.3622 ms]
change: [-79.353% -77.290% -74.995%] (p = 0.00 < 0.05)
Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
5 (5.00%) high mild
Benchmarking Stress functions: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 10.2s, or reduce sample count to 40.
Stress functions time: [99.906 ms 102.88 ms 105.94 ms]
change: [-19.498% -13.892% -8.4060%] (p = 0.00 < 0.05)
Performance has improved.