rusteerio 1.1.0 → 1.1.2

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.
Files changed (45) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/README.md +37 -37
  4. package/THIRD_PARTY_NOTICES.md +1 -1
  5. package/dist/{chunk-FPRP6UIX.mjs → chunk-HN63P3U7.mjs} +625 -401
  6. package/dist/chunk-HN63P3U7.mjs.map +1 -0
  7. package/dist/index.cjs +624 -400
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.mts +3 -2
  10. package/dist/index.d.ts +3 -2
  11. package/dist/index.mjs +1 -1
  12. package/dist/slim.cjs +555 -407
  13. package/dist/slim.cjs.map +1 -1
  14. package/dist/slim.d.mts +2 -2
  15. package/dist/slim.d.ts +2 -2
  16. package/dist/slim.mjs +1 -1
  17. package/dist/{types-Cs9UP1Vv.d.mts → types-CJsc0PH-.d.mts} +12 -0
  18. package/dist/{types-Cs9UP1Vv.d.ts → types-CJsc0PH-.d.ts} +12 -0
  19. package/dist/utils.d.mts +1 -1
  20. package/dist/utils.d.ts +1 -1
  21. package/native/src/arena.rs +163 -7
  22. package/native/src/attributes.rs +18 -1
  23. package/native/src/codec.rs +79 -0
  24. package/native/src/lib.rs +117 -30
  25. package/native/src/snapshot.rs +144 -89
  26. package/native/src/tokenizer.rs +34 -20
  27. package/package.json +1 -1
  28. package/rusteerio.darwin-arm64.node +0 -0
  29. package/rusteerio.darwin-x64.node +0 -0
  30. package/rusteerio.linux-arm64-gnu.node +0 -0
  31. package/rusteerio.linux-arm64-musl.node +0 -0
  32. package/rusteerio.linux-x64-gnu.node +0 -0
  33. package/rusteerio.linux-x64-musl.node +0 -0
  34. package/rusteerio.win32-arm64-msvc.node +0 -0
  35. package/rusteerio.win32-x64-msvc.node +0 -0
  36. package/src/extract.ts +117 -24
  37. package/src/index.ts +27 -6
  38. package/src/match.ts +4 -4
  39. package/src/native.ts +4 -0
  40. package/src/nodes.ts +70 -10
  41. package/src/router.ts +80 -4
  42. package/src/selection.ts +18 -17
  43. package/src/snapshot.ts +37 -0
  44. package/src/transport.ts +1 -1
  45. package/dist/chunk-FPRP6UIX.mjs.map +0 -1
package/Cargo.lock CHANGED
@@ -720,7 +720,7 @@ dependencies = [
720
720
 
721
721
  [[package]]
722
722
  name = "rusteerio"
723
- version = "1.1.0"
723
+ version = "1.1.2"
724
724
  dependencies = [
725
725
  "ego-tree",
726
726
  "html5ever",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rusteerio"
3
- version = "1.1.0"
3
+ version = "1.1.2"
4
4
  edition = "2021"
5
5
  description = "Rust HTML5 parser and CSS selector engine for the rusteerio Node.js package"
6
6
  license = "MIT"
package/README.md CHANGED
@@ -177,19 +177,19 @@ identical on all 5,000 pages, and times include loading.
177
177
 
178
178
  | Measure | Result |
179
179
  | --- | --- |
180
- | Total time | Cheerio 17.8 s, rusteerio 9.1 s: **1.97× faster** |
181
- | Pages where rusteerio was faster | **4,973 of 5,000** |
182
- | Per-page speedup, 10th / 50th / 90th percentile | 1.21× / 1.51× / 1.92× |
183
- | Slowest page | 0.78×, a 4 KB page |
180
+ | Total time | Cheerio 15.9 s, rusteerio 7.7 s: **2.06× faster** |
181
+ | Pages where rusteerio was faster | **4,995 of 5,000** |
182
+ | Per-page speedup, 10th / 50th / 90th percentile | 1.30× / 1.62× / 1.98× |
183
+ | Slowest page | 0.90× |
184
184
 
185
- The 27 slower pages are all small, where a few microseconds decide the ratio.
185
+ The five slower pages (0.90× to 1.00×) measured 1.14× to 2.01× faster when
186
+ rerun with 25 samples each on another machine.
186
187
 
187
188
  **Single operations.** `bench/operations.mjs` times 25 operations on freshly
188
189
  loaded generated documents of 200 and 2,000 cards. Including each engine's load
189
- time, rusteerio was faster for **48 to 49 of 50** HTML measurements across three
190
- runs (median 1.81–1.89×). XML results varied more between runs: **29 to 41 of 50**
191
- (median 1.08–1.38×). HTML loading alone was 1.76–1.96× faster; XML loading of the
192
- large document ranged from parity to 1.39× faster.
190
+ time, rusteerio was faster for **49 to 50 of 50** HTML measurements across two
191
+ runs (median 1.89–1.90×) and **48 of 50** XML measurements (median 1.84×). HTML
192
+ loading alone was 1.75–1.89× faster and XML loading 1.67–2.26× faster.
193
193
 
194
194
  **Matched CPU budgets.** `bench/fair.mjs` gives both engines the same enforced
195
195
  CPU budget; batch comparisons give Cheerio a reused Node worker pool and include
@@ -198,41 +198,41 @@ Rusteerio was faster in **all 45 cases**. Representative results:
198
198
 
199
199
  | Workload | CPUs | Cheerio | rusteerio | rusteerio |
200
200
  | --- | ---: | ---: | ---: | --- |
201
- | Load/query, 500 articles | 1 | 38.01 ms | 3.61 ms | 10.52× faster |
202
- | Load/query, 5,000 articles | 1 | 172.87 ms | 39.17 ms | 4.41× faster |
203
- | HTML mutations, 5,000 articles | 1 | 249.72 ms | 84.42 ms | 2.96× faster |
204
- | XML load/query, 5,000 articles | 1 | 69.34 ms | 18.20 ms | 3.81× faster |
205
- | Extract 16 documents × 5,000 articles | 1 | 3,441.82 ms | 533.58 ms | 6.45× faster |
206
- | Extract 16 documents × 5,000 articles | 8 | 1,126.61 ms | 179.02 ms | 6.29× faster |
207
- | Nested callback extraction, 8 × 500 articles | 8 | 78.27 ms | 52.03 ms | 1.50× faster |
208
- | Cold extraction, 16 × 20 articles | 8 | 179.01 ms | 33.78 ms | 5.30× faster |
209
- | 8 concurrent batches × 8 × 300 articles | 8 | 125.86 ms | 22.99 ms | 5.47× faster |
210
- | HTML stream, 50,000 elements | 1 | 1,364.09 ms | 328.79 ms | 4.15× faster |
211
- | XML stream, 50,000 elements | 8 | 123.17 ms | 100.52 ms | 1.23× faster |
212
- | Append/update/remove, 4,000 cycles | 1 | 666.87 ms | 458.55 ms | 1.45× faster |
201
+ | Load/query, 500 articles | 1 | 36.53 ms | 3.37 ms | 10.82× faster |
202
+ | Load/query, 5,000 articles | 1 | 152.78 ms | 34.90 ms | 4.38× faster |
203
+ | HTML mutations, 5,000 articles | 1 | 241.28 ms | 68.12 ms | 3.54× faster |
204
+ | XML load/query, 5,000 articles | 1 | 65.28 ms | 15.24 ms | 4.28× faster |
205
+ | Extract 16 documents × 5,000 articles | 1 | 2,874.89 ms | 447.12 ms | 6.43× faster |
206
+ | Extract 16 documents × 5,000 articles | 8 | 805.16 ms | 122.93 ms | 6.55× faster |
207
+ | Nested callback extraction, 8 × 500 articles | 8 | 54.17 ms | 33.09 ms | 1.64× faster |
208
+ | Cold extraction, 16 × 20 articles | 8 | 15.19 ms | 3.17 ms | 4.79× faster |
209
+ | 8 concurrent batches × 8 × 300 articles | 8 | 127.82 ms | 23.94 ms | 5.34× faster |
210
+ | HTML stream, 50,000 elements | 1 | 1,086.17 ms | 297.04 ms | 3.66× faster |
211
+ | XML stream, 50,000 elements | 8 | 122.06 ms | 67.44 ms | 1.81× faster |
212
+ | Append/update/remove, 4,000 cycles | 1 | 613.95 ms | 388.99 ms | 1.58× faster |
213
213
 
214
214
  Cold measurements include engine import, pool initialization and the first
215
215
  batch.
216
216
 
217
217
  **Where Cheerio can be faster.** Rusteerio builds node objects lazily from the
218
- native tree, so code that visits every node through DOM properties (walking
219
- `children` and reading `attribs` of every element) pays for creating those
220
- objects. Including load, that walk was 0.83–0.99× in HTML and 0.37–0.83× in XML,
221
- where Cheerio's htmlparser2 parser leaves less load time to win back. On the
222
- large XML document, wrapping thousands of elements one by one (`$(element)` with
223
- `.attr()`, `.parents()`, `.siblings()` or `.next()`), appending to thousands of
224
- elements and rewriting attributes element by element measured 0.58–0.97×. Very
225
- small pages can measure either way.
218
+ native tree, and an element's `attribs` is a `Proxy` so that assigning or
219
+ deleting a key changes the document, as it does in Cheerio. Code that visits
220
+ every node and enumerates every element's attributes (`Object.keys(node.attribs)`)
221
+ pays for creating those objects and for V8's slower key enumeration on proxies.
222
+ Including load, that walk measured 0.58–0.69× in XML, where Cheerio's
223
+ htmlparser2 parser leaves less load time to win back, and 1.00× or better in
224
+ HTML. Walking the same nodes without enumerating attributes is faster in both.
225
+ Very small pages can measure either way.
226
226
 
227
227
  **Memory.** A batch extracting 16 documents of 5,000 articles with eight CPUs
228
- ended at 595 MB RSS for rusteerio and 2,535 MB for Cheerio's worker pool, and the
229
- HTML stream of 50,000 elements at 491 MB versus 664 MB. The XML stream ended
230
- higher, at 421 MB versus 218 MB, and the append/update/remove workload about even
231
- (93 MB versus 90 MB). Linux builds use mimalloc, which keeps freed pages briefly
232
- for reuse; setting `MIMALLOC_PURGE_DELAY=0` returns them at once and lowered the
233
- streams to 363 MB (HTML) and 286 MB (XML), at a cost in speed for later
234
- documents. RSS includes initialization and resident input, and sampled peaks do
235
- not establish a universal memory bound.
228
+ ended at 581 MB RSS for rusteerio and 2,497 MB for Cheerio's worker pool, the
229
+ HTML stream of 50,000 elements at 491 MB versus 666 MB, and the large XML
230
+ load/query at 140 MB versus 147 MB. The XML stream ended higher, at 285 MB versus
231
+ 221 MB, and the append/update/remove workload about even (93 MB versus 91 MB).
232
+ Linux builds use mimalloc, which keeps freed pages briefly for reuse; setting
233
+ `MIMALLOC_PURGE_DELAY=0` returns them at once and lowers stream RSS, at a cost in
234
+ speed for later documents. RSS includes initialization and resident input, and
235
+ sampled peaks do not establish a universal memory bound.
236
236
 
237
237
  These results describe this VM and revision; hardware, runtime and input shape
238
238
  affect them. See [the results](bench/results/2026-10-14/) and
@@ -4,7 +4,7 @@ This file preserves third-party license and attribution notices for the Rust nat
4
4
 
5
5
  Generated by `node scripts/generate-notices.mjs` from `cargo metadata --locked`, crate license files, and the pinned supplemental sources recorded in `scripts/notices/sources.json`. It includes build dependencies and dependencies for all target platforms; a particular binary may use a subset. Identical notice texts are reproduced once and referenced below. The html5ever, markup5ever and html5gum crates contain local observer-hook and opt-in UTF-16 transport patches; their complete patched source and original notices are included in `native/vendor`. Other dependency source files are unmodified.
6
6
 
7
- Cargo.lock SHA-256: `a7962957958e0640ea9e40f025e877864c03bd5934a1ca2e19df80a5481d72ff`.
7
+ Cargo.lock SHA-256: `b834f3bb9a4bb9e7889f20f789f80af645271bcfd0057cf4217843b17e3f5ae5`.
8
8
 
9
9
  ## Source availability
10
10