From 8fad7dbac3343f186cae8ad52282315aa3d56a5f Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Mon, 15 Jul 2024 04:31:51 +0000 Subject: [PATCH] perf(semantic): reduce `AstNodeId` to `u32` (#4264) `AstNodeId` was a `usize`. This seems excessive. Parser has a limit on size of a JS file of 4 GiB. While it is *possible* for a JS file of that size to create an AST with more than `1 << 32` (~4 billion) AST nodes, that would be insanely large. So make `AstNodeId` `u32` instead. --- crates/oxc_syntax/src/node.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/oxc_syntax/src/node.rs b/crates/oxc_syntax/src/node.rs index c7d6eaa6894ef..187e4da854d3a 100644 --- a/crates/oxc_syntax/src/node.rs +++ b/crates/oxc_syntax/src/node.rs @@ -2,7 +2,7 @@ use bitflags::bitflags; use oxc_index::define_index_type; define_index_type! { - pub struct AstNodeId = usize; + pub struct AstNodeId = u32; } impl AstNodeId {