perf: switch to ahash, indexmap-allocator-api

This commit is contained in:
Guillem L. Jara
2026-05-25 01:50:22 +02:00
parent 8e979cfad1
commit 98fa3c33c2
8 changed files with 102 additions and 23 deletions
+1
View File
@@ -14,6 +14,7 @@ smallvec.workspace = true
bumpalo.workspace = true
hashbrown.workspace = true
allocator-api2.workspace = true
ahash.workspace = true
ariadne = "0.6.0"
[lints]
+3 -2
View File
@@ -5,9 +5,10 @@
use std::fmt::Debug;
use ahash::RandomState;
use bumpalo::{Bump, boxed::Box, collections::Vec};
use either::Either;
use hashbrown::{DefaultHashBuilder, HashMap};
use hashbrown::HashMap;
use lexer::{Slice, Span, Token};
use crate::{ParsingError, Result, lex::TokenExt};
@@ -21,7 +22,7 @@ pub struct Ast<'a> {
pub end_file: Vec<'a, Body<'a>>,
pub rules: Vec<'a, Rule<'a>>,
pub concurrent: Vec<'a, Rule<'a>>,
pub functions: HashMap<Identifier<'a>, Function<'a>, DefaultHashBuilder, &'a Bump>,
pub functions: HashMap<Identifier<'a>, Function<'a>, RandomState, &'a Bump>,
}
#[derive(Debug)]
+2 -1
View File
@@ -16,6 +16,7 @@ mod tests;
use std::{fmt::Debug, mem::replace};
use ahash::RandomState;
use bumpalo::{Bump, boxed::Box, collections::Vec, vec};
use either::Either::{Left, Right};
use hashbrown::HashMap;
@@ -685,7 +686,7 @@ impl<'a> Ast<'a> {
end_file: Vec::new_in(arena),
rules: Vec::new_in(arena),
concurrent: Vec::new_in(arena),
functions: HashMap::new_in(arena),
functions: HashMap::with_hasher_in(RandomState::new(), arena),
}
}
}