feat: use hashbrown

This commit is contained in:
2025-05-17 19:45:41 +08:00
parent fb14027845
commit 7b55a15281
12 changed files with 89 additions and 34 deletions

View File

@@ -1,10 +1,12 @@
extern crate test;
use hashbrown::HashMap;
use inkwell::context::Context;
use test::{Bencher, black_box};
use ecow::EcoString;
use rpds::{ht_map, vector_sync};
use rpds::vector_sync;
use crate::compile::compile;
use crate::ir::downgrade;
@@ -24,6 +26,19 @@ fn test_expr(expr: &str, expected: Value) {
assert_eq!(run(prog, jit).unwrap(), expected);
}
macro_rules! map {
($($k:expr => $v:expr),*) => {
{
#[allow(unused_mut)]
let mut m = HashMap::new();
$(
m.insert($k, $v);
)*
m
}
};
}
macro_rules! thunk {
() => {
Value::Thunk
@@ -68,7 +83,7 @@ macro_rules! list {
macro_rules! attrs {
($($x:tt)*) => (
Value::AttrSet(AttrSet::new(ht_map!{$($x)*}))
Value::AttrSet(AttrSet::new(map!{$($x)*}))
)
}