mirror of
https://github.com/aphrody-labs/oxc.git
synced 2026-10-14 22:29:17 +00:00
perf(minifier): update nodes in place in wrap_to_avoid_ambiguous_else (#27194)
wrap body in place without creating empty nodes in `wrap_to_avoid_ambiguous_else`
This commit is contained in:
1 parent
1c352ce311
commit
028ffb85c6
2 files changed
+8
-12
No files matched your search
@@ -127,13 +127,9 @@ impl<'a> PeepholeOptimizations {
|
||||
&& if2.alternate.is_some()
|
||||
{
|
||||
let scope_id = ctx.create_child_scope_of_current(ScopeFlags::empty());
|
||||
let new_consequent = Statement::new_block_statement_with_scope_id(
|
||||
if_stmt.consequent.span(),
|
||||
[if_stmt.consequent.take_in(ctx)],
|
||||
scope_id,
|
||||
ctx,
|
||||
);
|
||||
ctx.replace_statement(&mut if_stmt.consequent, new_consequent);
|
||||
ctx.replace_statement_with(&mut if_stmt.consequent, |e, ctx| {
|
||||
Statement::new_block_statement_with_scope_id(e.span(), [e], scope_id, ctx)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ checker.ts:
|
||||
sys deallocs: 122
|
||||
sys alloc bytes: 14996287 # 15.00 MB
|
||||
sys peak growth: 10169560 # 10.17 MB
|
||||
arena allocs: 56217
|
||||
arena allocs: 56214
|
||||
arena reallocs: 5084
|
||||
arena size: 16317568 # 16.32 MB
|
||||
|
||||
@@ -16,7 +16,7 @@ App.tsx:
|
||||
sys deallocs: 61
|
||||
sys alloc bytes: 2128539 # 2.13 MB
|
||||
sys peak growth: 1612427 # 1.61 MB
|
||||
arena allocs: 7470
|
||||
arena allocs: 7469
|
||||
arena reallocs: 920
|
||||
arena size: 2683792 # 2.68 MB
|
||||
|
||||
@@ -38,7 +38,7 @@ pdf.mjs:
|
||||
sys deallocs: 2427
|
||||
sys alloc bytes: 5313795 # 5.31 MB
|
||||
sys peak growth: 3693355 # 3.69 MB
|
||||
arena allocs: 19590
|
||||
arena allocs: 19585
|
||||
arena reallocs: 2574
|
||||
arena size: 5710976 # 5.71 MB
|
||||
|
||||
@@ -49,7 +49,7 @@ antd.js:
|
||||
sys deallocs: 860
|
||||
sys alloc bytes: 29973448 # 29.97 MB
|
||||
sys peak growth: 19934725 # 19.93 MB
|
||||
arena allocs: 181536
|
||||
arena allocs: 181528
|
||||
arena reallocs: 34406
|
||||
arena size: 43039192 # 43.04 MB
|
||||
|
||||
@@ -71,6 +71,6 @@ kitchen-sink.tsx:
|
||||
sys deallocs: 1854
|
||||
sys alloc bytes: 5304252 # 5.30 MB
|
||||
sys peak growth: 3707425 # 3.71 MB
|
||||
arena allocs: 31037
|
||||
arena allocs: 31033
|
||||
arena reallocs: 3012
|
||||
arena size: 8439864 # 8.44 MB
|
||||
Reference in new issue
Block a user