@miaskiewicz/turbo-dom 0.1.54 → 0.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miaskiewicz/turbo-dom",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "description": "Faster, more spec-correct DOM for test runners — native html5ever (Rust/WASM) parser + lazy copy-on-write DOM. A drop-in-style alternative to jsdom/happy-dom for vitest & jest.",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
package/src/core.rs CHANGED
@@ -261,10 +261,12 @@ pub fn parse_html_soa(html: &str) -> Soa {
261
261
  .expect("RcDom read_from is infallible over a byte slice");
262
262
  let mut b = SoaBuilder {
263
263
  soa: Soa::default(),
264
- tag_map: rustc_hash::FxHashMap::default(),
265
- attr_name_map: rustc_hash::FxHashMap::default(),
266
- attr_prefix_map: rustc_hash::FxHashMap::default(),
267
- attr_value_map: rustc_hash::FxHashMap::default(),
264
+ // pre-reserve typical intern-table sizes so the build loop doesn't rehash:
265
+ // tag/attr-name sets are small + bounded; values vary more.
266
+ tag_map: rustc_hash::FxHashMap::with_capacity_and_hasher(32, Default::default()),
267
+ attr_name_map: rustc_hash::FxHashMap::with_capacity_and_hasher(64, Default::default()),
268
+ attr_prefix_map: rustc_hash::FxHashMap::with_capacity_and_hasher(8, Default::default()),
269
+ attr_value_map: rustc_hash::FxHashMap::with_capacity_and_hasher(128, Default::default()),
268
270
  };
269
271
  b.alloc(&dom.document, -1);
270
272
  b.soa
Binary file
Binary file