perf(napi/parser, linter/plugins): initialize vars as 0 (#21020)

Tiny optimization to raw transfer string deserialization. Initialize vars which contain integers as `0`. This may help V8 optimize usage of these variables as they always have SMI type.

The effect, if there is one, is too small to register on benchamarks. But it's certainly not a regression, and may be a tiny gain, so why not?
This commit is contained in:
overlookmotel committed 2026-04-03 22:05:21 +00:00
1 parent c25ef02453
commit 55e1e9b1d2
10 files changed
+27 -11

No files matched your search

+2 -2
View File
@@ -8,8 +8,8 @@ let uint8,
uint32,
float64,
sourceText,
sourceStartPos,
firstNonAsciiPos,
sourceStartPos = 0,
firstNonAsciiPos = 0,
parent = null,
getLoc;
@@ -1,7 +1,11 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.
let uint8, uint32, float64, sourceText, firstNonAsciiPos;
let uint8,
uint32,
float64,
sourceText,
firstNonAsciiPos = 0;
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
@@ -5,7 +5,7 @@ let uint8,
uint32,
float64,
sourceText,
firstNonAsciiPos,
firstNonAsciiPos = 0,
parent = null;
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }),
@@ -1,7 +1,11 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.
let uint8, uint32, float64, sourceText, firstNonAsciiPos;
let uint8,
uint32,
float64,
sourceText,
firstNonAsciiPos = 0;
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
@@ -5,7 +5,7 @@ let uint8,
uint32,
float64,
sourceText,
firstNonAsciiPos,
firstNonAsciiPos = 0,
parent = null;
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }),
@@ -1,7 +1,11 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.
let uint8, uint32, float64, sourceText, firstNonAsciiPos;
let uint8,
uint32,
float64,
sourceText,
firstNonAsciiPos = 0;
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
@@ -5,7 +5,7 @@ let uint8,
uint32,
float64,
sourceText,
firstNonAsciiPos,
firstNonAsciiPos = 0,
parent = null;
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }),
@@ -1,7 +1,11 @@
// Auto-generated code, DO NOT EDIT DIRECTLY!
// To edit this generated file you have to edit `tasks/ast_tools/src/generators/raw_transfer.rs`.
let uint8, uint32, float64, sourceText, firstNonAsciiPos;
let uint8,
uint32,
float64,
sourceText,
firstNonAsciiPos = 0;
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }),
decodeStr = textDecoder.decode.bind(textDecoder),
@@ -5,7 +5,7 @@ let uint8,
uint32,
float64,
sourceText,
firstNonAsciiPos,
firstNonAsciiPos = 0,
parent = null;
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: true }),
@@ -143,7 +143,7 @@ fn generate_deserializers(
import {{ comments, initComments }} from '../plugins/comments.js';
/* END_IF */
let uint8, uint32, float64, sourceText, sourceStartPos, firstNonAsciiPos;
let uint8, uint32, float64, sourceText, sourceStartPos = 0, firstNonAsciiPos = 0;
let parent = null;
let getLoc;