Skip to content

Commit

Permalink
perf(semantic): reduce AstNodeId to u32 (#4264)
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
overlookmotel committed Jul 15, 2024
1 parent 23743db commit 8fad7db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/oxc_syntax/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8fad7db

Please sign in to comment.