Skip to content

Commit 56ebcb9

Browse files
fix: restore missing LFS objects and update benchmarks
- Recreate simple.html test fixture for CI - Regenerate benchmark artifacts with 10 iterations - Update README with latest benchmark results - Fix CI failures due to missing LFS objects (63e0267c9f, f2ea1e465b)
1 parent 03fea90 commit 56ebcb9

4 files changed

Lines changed: 104 additions & 59 deletions

File tree

README.md

Lines changed: 98 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ const options: Options = {
101101
## Benchmarks
102102

103103
<!-- BENCHMARK:START -->
104-
<!-- Last updated: 2025-09-29T07:21:48.642Z -->
104+
<!-- Last updated: 2025-09-29T08:44:59.546Z -->
105105

106106
## Performance
107107

108108
**Runtime ranking (lower is better):**
109-
1. mdream — 1.054ms
110-
2. h2m-parser — 1.074ms
111-
3. node-html-markdown — 3.694ms
112-
4. Turndown — 5.581ms
109+
1. mdream — 1.133ms
110+
2. h2m-parser — 1.193ms
111+
3. node-html-markdown — 3.894ms
112+
4. Turndown — 5.830ms
113113

114114
<details>
115115
<summary>📊 Benchmark Results (click to expand)</summary>
@@ -119,8 +119,8 @@ const options: Options = {
119119
- **Dataset:** 94 files (5 synthetic + 89 real HTML documents)
120120
- **Dataset path:** tests/fixtures
121121
- **File sizes:** 21KB to 420KB (mean: ~104KB)
122-
- **Iterations:** 1000 per file for statistical significance
123-
- **Total runtime:** 2024.7 seconds
122+
- **Iterations:** 10 per file for statistical significance
123+
- **Total runtime:** 41.3 seconds
124124
- **Environment:** Node.js with standard V8 optimizations
125125

126126
### Average Processing Time
@@ -129,21 +129,22 @@ Tested across 94 files in tests/fixtures (up to 420KB):
129129

130130
| Library | Without Readability | With Readability | Relative |
131131
|---------|---------------------|------------------|----------|
132-
| mdream | 1.054ms | ❌ Not supported | Fastest |
133-
| **h2m-parser**| **1.074ms** | 7.639ms | **Fastest** |
134-
| node-html-markdown | 3.694ms | ❌ Not supported | 3.50x slower |
135-
| Turndown | 5.581ms | ❌ Not supported | 5.29x slower |
132+
| mdream | 1.133ms | ❌ Not supported | Fastest |
133+
| **h2m-parser**| **1.193ms** | 7.707ms | **1.05x slower** |
134+
| node-html-markdown | 3.894ms | ❌ Not supported | 3.44x slower |
135+
| Turndown | 5.830ms | ❌ Not supported | 5.15x slower |
136136

137-
**Readability overhead (h2m-parser):** +6.565ms (enables article extraction + content cleaning)
137+
**Readability overhead (h2m-parser):** +6.513ms (enables article extraction + content cleaning)
138138

139139
### Performance Analysis
140140

141-
- **Fastest baseline:** mdream averages 1.054ms per document without Readability.
142-
- **h2m-parser gap to mdream:** 1.02× slower ( mdream: 1.054ms → h2m-parser: 1.074ms ).
143-
- **h2m-parser vs Turndown:** 5.20x faster (5.581ms → 1.074ms)
144-
- **h2m-parser vs node-html-markdown:** 3.44x faster (3.694ms → 1.074ms)
145-
- **h2m-parser vs mdream:** 0.98x slower (1.054ms → 1.074ms)
146-
- **Readability impact:** 7.1x slower when enabled (1.074ms → 7.639ms)
141+
- **Fastest baseline:** mdream averages 1.133ms per document without Readability.
142+
- **h2m-parser gap to mdream:** 1.05× slower ( mdream: 1.133ms → h2m-parser: 1.193ms ).
143+
- **h2m-parser vs Turndown:** 4.89x faster (5.830ms → 1.193ms)
144+
- **h2m-parser vs node-html-markdown:** 3.26x faster (3.894ms → 1.193ms)
145+
- **h2m-parser vs mdream:** 0.95x slower (1.133ms → 1.193ms)
146+
- **Readability impact:** 6.5x slower when enabled (1.193ms → 7.707ms)
147+
- **Token savings vs raw HTML:** 24051 tokens saved (95.63%) on tests/fixtures/039c4b966d1f2a0c589ac0aad211fe65500ad1cb58c7f45b34251db7056803ec.html.
147148
- **Algorithmic complexity:** O(n) linear scaling confirmed across file sizes
148149

149150
### Performance Projections
@@ -152,82 +153,126 @@ Estimated processing times for different file sizes (without Readability):
152153

153154
```
154155
100KB 1ms
155-
1MB 11ms
156-
10MB 106ms
157-
100MB 1.1s
156+
1MB 12ms
157+
10MB 117ms
158+
100MB 1.2s
158159
```
159160

160-
*Based on linear scaling from 104KB average file size at 1.074ms*
161+
*Based on linear scaling from 104KB average file size at 1.193ms*
161162

162163
### Detailed Results by File Size
163164

164165
#### tiny (18 bytes)
165166

166167
| Library | Mean (ms) | P95 (ms) | P99 (ms) |
167168
|---------|-----------|----------|----------|
168-
| h2m-parser (no Readability) | 0.008 | 0.011 | 0.012 |
169-
| h2m-parser (with Readability) | 0.105 | 0.141 | 0.151 |
170-
| Turndown | 0.011 | 0.016 | 0.018 |
171-
| node-html-markdown | 0.006 | 0.008 | 0.009 |
172-
| Mdream | 0.002 | 0.004 | 0.004 |
169+
| h2m-parser (no Readability) | 0.014 | 0.018 | 0.018 |
170+
| h2m-parser (with Readability) | 0.253 | 0.341 | 0.341 |
171+
| Turndown | 0.033 | 0.047 | 0.047 |
172+
| node-html-markdown | 0.013 | 0.018 | 0.018 |
173+
| Mdream | 0.007 | 0.011 | 0.011 |
173174

174175
#### small (84 bytes)
175176

176177
| Library | Mean (ms) | P95 (ms) | P99 (ms) |
177178
|---------|-----------|----------|----------|
178-
| h2m-parser (no Readability) | 0.009 | 0.012 | 0.012 |
179-
| h2m-parser (with Readability) | 0.121 | 0.142 | 0.146 |
180-
| Turndown | 0.023 | 0.028 | 0.030 |
181-
| node-html-markdown | 0.012 | 0.015 | 0.016 |
182-
| Mdream | 0.005 | 0.009 | 0.009 |
179+
| h2m-parser (no Readability) | 0.026 | 0.029 | 0.029 |
180+
| h2m-parser (with Readability) | 0.225 | 0.261 | 0.261 |
181+
| Turndown | 0.064 | 0.079 | 0.079 |
182+
| node-html-markdown | 0.035 | 0.045 | 0.045 |
183+
| Mdream | 0.017 | 0.020 | 0.020 |
183184

184185
#### medium (369 bytes)
185186

186187
| Library | Mean (ms) | P95 (ms) | P99 (ms) |
187188
|---------|-----------|----------|----------|
188-
| h2m-parser (no Readability) | 0.011 | 0.012 | 0.012 |
189-
| h2m-parser (with Readability) | 0.169 | 0.177 | 0.179 |
190-
| Turndown | 0.032 | 0.034 | 0.035 |
191-
| node-html-markdown | 0.017 | 0.020 | 0.025 |
192-
| Mdream | 0.009 | 0.010 | 0.011 |
189+
| h2m-parser (no Readability) | 0.025 | 0.039 | 0.039 |
190+
| h2m-parser (with Readability) | 0.371 | 0.474 | 0.474 |
191+
| Turndown | 0.078 | 0.088 | 0.088 |
192+
| node-html-markdown | 0.046 | 0.065 | 0.065 |
193+
| Mdream | 0.048 | 0.056 | 0.056 |
193194

194195
#### file_42 (21KB)
195196

196197
| Library | Mean (ms) | P95 (ms) | P99 (ms) |
197198
|---------|-----------|----------|----------|
198-
| h2m-parser (no Readability) | 0.246 | 0.259 | 0.264 |
199-
| h2m-parser (with Readability) | 1.798 | 1.907 | 1.935 |
200-
| Turndown | 1.362 | 1.444 | 1.475 |
201-
| node-html-markdown | 0.396 | 0.414 | 0.422 |
202-
| Mdream | 0.345 | 0.361 | 0.365 |
199+
| h2m-parser (no Readability) | 0.270 | 0.307 | 0.307 |
200+
| h2m-parser (with Readability) | 1.930 | 2.146 | 2.146 |
201+
| Turndown | 1.374 | 1.502 | 1.502 |
202+
| node-html-markdown | 0.420 | 0.465 | 0.465 |
203+
| Mdream | 0.352 | 0.405 | 0.405 |
203204

204205
#### file_33 (88KB)
205206

206207
| Library | Mean (ms) | P95 (ms) | P99 (ms) |
207208
|---------|-----------|----------|----------|
208-
| h2m-parser (no Readability) | 0.983 | 1.059 | 1.081 |
209-
| h2m-parser (with Readability) | 6.108 | 6.673 | 8.701 |
210-
| Turndown | 5.762 | 6.988 | 7.064 |
211-
| node-html-markdown | 2.975 | 3.206 | 3.241 |
212-
| Mdream | 1.877 | 1.965 | 1.985 |
209+
| h2m-parser (no Readability) | 1.040 | 1.169 | 1.169 |
210+
| h2m-parser (with Readability) | 5.909 | 6.208 | 6.208 |
211+
| Turndown | 6.228 | 7.849 | 7.849 |
212+
| node-html-markdown | 3.644 | 4.039 | 4.039 |
213+
| Mdream | 2.001 | 2.194 | 2.194 |
213214

214215
#### file_88 (420KB)
215216

216217
| Library | Mean (ms) | P95 (ms) | P99 (ms) |
217218
|---------|-----------|----------|----------|
218-
| h2m-parser (no Readability) | 3.002 | 3.292 | 3.375 |
219-
| h2m-parser (with Readability) | 30.321 | 34.749 | 35.263 |
220-
| Turndown | 13.106 | 14.789 | 14.968 |
221-
| node-html-markdown | 7.384 | 7.854 | 7.921 |
222-
| Mdream | 8.668 | 9.064 | 9.142 |
219+
| h2m-parser (no Readability) | 3.264 | 3.406 | 3.406 |
220+
| h2m-parser (with Readability) | 28.608 | 32.022 | 32.022 |
221+
| Turndown | 13.271 | 15.061 | 15.061 |
222+
| node-html-markdown | 7.431 | 7.629 | 7.629 |
223+
| Mdream | 9.212 | 9.926 | 9.926 |
223224

224225
*See [`bench/comparison-results.md`](bench/comparison-results.md) for complete results across all 94 files*
225226

227+
### Workflow Comparison (Await vs Stream)
228+
229+
| Mode | Iterations | Mean (ms) | p95 (ms) | Min (ms) | Max (ms) |
230+
|------|------------|-----------|----------|----------|----------|
231+
| h2m-parser (await) | 10 | 13.71 | 60.63 | 6.99 | 60.63 |
232+
| mdream (await) | 10 | 3.38 | 15.12 | 1.59 | 15.12 |
233+
| mdream (stream) | 10 | 13.63 | 105.06 | 2.00 | 105.06 |
234+
235+
### Token Savings
236+
237+
- Model: gpt-4o-mini
238+
- HTML tokens: 25151
239+
- Markdown tokens: 1100
240+
- Savings: 24051 tokens (95.63%)
241+
- Estimated cost delta per document: $0.003608
242+
- Markdown length: 4869 characters
243+
244+
### Memory Snapshot
245+
246+
- Mode: h2m-reuse
247+
- Iterations: 10
248+
- RSS change: 47.72 MB
249+
250+
### Bundle Size Snapshot
251+
252+
Generated: 2025-09-28T17:49:58.314Z
253+
254+
| File | Size | Gzipped | Δ Size | Δ Gzipped |
255+
|------|------|---------|--------|-----------|
256+
| cli.cjs | 22KB | 8KB | +0 B (+0.00%) | +0 B (+0.00%) |
257+
| cli.mjs | 22KB | 8KB | +0 B (+0.00%) | +0 B (+0.00%) |
258+
| index.cjs | 19KB | 7KB | +0 B (+0.00%) | +0 B (+0.00%) |
259+
| index.mjs | 19KB | 7KB | +0 B (+0.00%) | +0 B (+0.00%) |
260+
261+
### Live Fetch Results
262+
263+
Fetched: https://en.wikipedia.org/wiki/Markdown
264+
265+
| Tool | Mean | Min | Max |
266+
|------|------|-----|-----|
267+
| h2m-parser | 51.89ms | 44.27ms | 66.55ms |
268+
| mdream (await) | 6.54ms | 3.98ms | 11.20ms |
269+
| mdream (stream) | 12.89ms | 11.85ms | 14.91ms |
270+
226271
### Feature Comparison
227272

228273
| Feature | h2m-parser | Turndown | node-html-markdown | mdream |
229274
|---------|------------|----------|--------------------|--------|
230-
| **Performance** | ✅ Fastest | ❌ +429% slower | ❌ +250% slower | ✅ Fastest |
275+
| **Performance** | ⚠️ +5% slower | ❌ +415% slower | ❌ +244% slower | ✅ Fastest |
231276
| **Readability** |||| ⚠️ |
232277
| **Link cleanup** |||| ⚠️ |
233278
| **Front matter** |||||
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:169ec118dc70b2147f0ae0a5ea27143d8f3c7a70a8fb9e25ec6378ef887e055f
3-
size 182385
2+
oid sha256:8b30c85c7c9f3b6ee358d8a8503969dec324f0d88fe74b244d3d7b63eb599816
3+
size 180118

bench/.results/summary-latest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:63e0267c9f9d9e4b7c7cfa685f55099879a48e4cb30ef6882d9851c705d75711
3-
size 9927
2+
oid sha256:9e785e6ab86b1cf7a391809d326750c7dfa61cba0ffce296953cd9c0eb250870
3+
size 9930

tests/fixtures/simple.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:f2ea1e465bf588290167f8b8e369e6e8d3204e7ae8d8d80754f6b9af848aac96
3-
size 587
2+
oid sha256:e2a342f205600ec7f8ce0d1de4fa39c457b386753de99c23bdd7f22070b228ff
3+
size 675

0 commit comments

Comments
 (0)