Fix: Remove unnecessary Rc::new from LambdaCollector
The `LambdaCollector` was cloning nodes and wrapping them in `Rc`. However, the `registry` itself is already holding `Rc` clones of the nodes. This commit removes the redundant `Rc::new` to simplify the code. This change also addresses a performance regression observed in benchmarks due to unnecessary atomic overhead from `Arc` in the `Keyword` type.
This commit is contained in:
@@ -67,6 +67,9 @@ impl NodeIdentity {
|
||||
pub struct Keyword(pub u32);
|
||||
|
||||
static KEYWORD_REGISTRY: OnceLock<Mutex<HashMap<String, u32>>> = OnceLock::new();
|
||||
// We use String here instead of Arc<str> because benchmarks (e.g. record_optimizations.myc)
|
||||
// showed a 4% performance regression with Arc due to atomic overhead during formatting.
|
||||
// Since name() is mostly used for diagnostics and UI, the deep clone is acceptable.
|
||||
static KEYWORD_REVERSE: OnceLock<Mutex<Vec<String>>> = OnceLock::new();
|
||||
|
||||
impl Keyword {
|
||||
|
||||
Reference in New Issue
Block a user