feat(minifier): fold constants if the folded expression is shorter than the original one#9008
Conversation
…an the original one
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Can you move this out of the stack so I can merge the other PRs first? This PR is interesting ;-) |
CodSpeed Performance ReportMerging #9008 will degrade performances by 87.02%Comparing Summary
Benchmarks breakdown
|
|
I knew it!
|
| p.add_source_mapping(self.span); | ||
| let last = p.last_byte(); | ||
| let pattern_text = self.regex.pattern.source_text(p.source_text); | ||
| let pattern_text = self.regex.pattern.to_string(); |
There was a problem hiding this comment.
Because I'm not calling CodeGen::build in count_char_when_printing, self.regex.pattern.source_text(p.source_text) errors due to CodeGen::source_text being an empty string.
let mut cg = Codegen::new()
.with_options(CodegenOptions { minify: true, ..CodegenOptions::default() });
cg.print_expression(expr);
cg.into_source_text().len()|
Let's reconsider this approach once we stabilize the minifier. |

No description provided.