From 25b8e6a714d2217e8735a925bc751900bce09d53 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 18 Nov 2024 15:43:11 -0800 Subject: Use hints when generating fresh labels in IRBuilder (#7086) IRBuilder often has to generate new label names for blocks and other scopes. Previously it would generate each new name by starting with "block" or "label" and incrementing a suffix until finding a fresh name, but this made name generation quadratic in the number of names to generate. To spend less time generating names, track a hint index at which to start looking for a fresh name and increment it every time a name is generated. This speeds up a version of the binary parser that uses IRBuilder by about 15%. --- test/wasm2js/labels.2asm.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/wasm2js/labels.2asm.js') diff --git a/test/wasm2js/labels.2asm.js b/test/wasm2js/labels.2asm.js index ac2978300..431e172d9 100644 --- a/test/wasm2js/labels.2asm.js +++ b/test/wasm2js/labels.2asm.js @@ -143,10 +143,6 @@ function asmFunc(imports) { break label; } i = i + 1 | 0; - label0 : { - break label0; - } - i = i + 1 | 0; label1 : { break label1; } @@ -159,6 +155,10 @@ function asmFunc(imports) { break label3; } i = i + 1 | 0; + label4 : { + break label4; + } + i = i + 1 | 0; return i | 0; } -- cgit v1.2.3