···11+// Benchmark to test function declaration hoisting optimization
22+// The function contains "function" in strings/comments but no actual declarations
33+44+function processItem(item) {
55+ // This comment mentions function declaration hoisting
66+ // The word "function" appears here: function function function
77+ let type = "function"; // string contains "function"
88+ let desc = "This is a function test";
99+ let x = item * 2;
1010+ let y = x + 1;
1111+ return y + type.length + desc.length;
1212+}
1313+1414+const iterations = 200000;
1515+console.log(`Running ${iterations} iterations...`);
1616+1717+let start = Date.now();
1818+let result = 0;
1919+2020+for (let i = 0; i < iterations; i++) {
2121+ result += processItem(i);
2222+}
2323+2424+console.log(`with "function" in body: ${Date.now() - start}ms (result: ${result})`);
2525+2626+// Compare with a function that doesn't have "function" anywhere
2727+function processClean(item) {
2828+ let type = "method";
2929+ let desc = "This is a test";
3030+ let x = item * 2;
3131+ let y = x + 1;
3232+ return y + type.length + desc.length;
3333+}
3434+3535+start = Date.now();
3636+result = 0;
3737+3838+for (let i = 0; i < iterations; i++) {
3939+ result += processClean(i);
4040+}
4141+4242+console.log(`without "function" in body: ${Date.now() - start}ms (result: ${result})`);