mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 02:31:13 +08:00
refactor: 扁平化对象属性存储并优化常量池与 IC 热路径
This commit is contained in:
@@ -24,6 +24,14 @@ struct StringForgeInner {
|
||||
entries: Vec<StringEntry>,
|
||||
}
|
||||
|
||||
/// Global string interning pool shared by all VMs.
|
||||
///
|
||||
/// Concurrency model:
|
||||
/// `StringForge` keeps a single `RwLock` around the interner state.
|
||||
/// - `lookup()` takes a shared read lock and scales across readers.
|
||||
/// - `intern()` uses a read-check then write-check pattern to keep hot-path hits cheap.
|
||||
/// - New string insertion is serialized, which matches the workload here: most strings
|
||||
/// are interned early and later accesses are dominated by reads.
|
||||
pub struct StringForge {
|
||||
inner: RwLock<StringForgeInner>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user