Skip to content

Commit 958875a

Browse files
kylehowellsclaude
andcommitted
Include synthetic.html in rust-justhtml benchmarks
Updated compare.py to include test_files directory for rust-justhtml benchmarks, ensuring synthetic.html (21MB stress test) is included. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 95140a6 commit 958875a

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

Benchmarks/BENCHMARK_RESULTS.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Cross-Implementation Benchmark Results
22

3-
**Generated:** 2025-12-20 08:25:39
3+
**Generated:** 2025-12-20 08:43:16
44

55
## Repository Versions
66

77
| Project | Branch | Commit | Date |
88
|---------|--------|--------|------|
9-
| swift-justhtml | master | `8a175066b4d9` | 2025-12-19 |
9+
| swift-justhtml | master | `95140a64878b` | 2025-12-20 |
1010
| justhtml (Python) | main | `63c29b26be64` | 2025-12-16 |
1111
| justjshtml (JavaScript) | main | `e29dbd3166e9` | 2025-12-16 |
1212
| html5ever (Rust) | main | `795caf4166a8` | 2025-12-05 |
@@ -29,30 +29,30 @@ All implementations produce **identical output** for all test files.
2929

3030
| File | Size | html5ever | rust-justhtml | Swift | JavaScript | Python |
3131
|------|------|-----------|---------------|-------|------------|--------|
32-
| hackernews.html | 34 KB | 0.49 ms | 0.82 ms | 2.07 ms | 1.78 ms | 7.75 ms |
33-
| synthetic.html | 20498 KB | 277.46 ms | N/A | 1218.07 ms | 911.40 ms | 3598.33 ms |
34-
| wikipedia_countries.html | 360 KB | 3.95 ms | 7.29 ms | 14.27 ms | 15.29 ms | 90.98 ms |
35-
| wikipedia_html.html | 472 KB | 5.19 ms | 10.89 ms | 19.04 ms | 21.49 ms | 104.24 ms |
36-
| wikipedia_swift.html | 411 KB | 4.55 ms | 9.70 ms | 16.96 ms | 16.40 ms | 133.33 ms |
37-
| wikipedia_ww2.html | 1204 KB | 12.62 ms | 24.61 ms | 43.82 ms | 46.10 ms | 240.23 ms |
38-
| **TOTAL** | | **304 ms** | **53 ms** | **1314 ms** | **1012 ms** | **4175 ms** |
32+
| hackernews.html | 34 KB | 0.51 ms | 0.82 ms | 2.09 ms | 1.86 ms | 7.71 ms |
33+
| synthetic.html | 20498 KB | 274.73 ms | 642.55 ms | 1222.32 ms | 1083.18 ms | 3619.55 ms |
34+
| wikipedia_countries.html | 360 KB | 4.19 ms | 7.67 ms | 14.27 ms | 19.23 ms | 90.88 ms |
35+
| wikipedia_html.html | 472 KB | 5.41 ms | 10.81 ms | 18.93 ms | 25.03 ms | 105.46 ms |
36+
| wikipedia_swift.html | 411 KB | 4.61 ms | 8.98 ms | 17.23 ms | 19.89 ms | 133.11 ms |
37+
| wikipedia_ww2.html | 1204 KB | 12.64 ms | 25.14 ms | 43.78 ms | 57.04 ms | 240.39 ms |
38+
| **TOTAL** | | **302 ms** | **696 ms** | **1319 ms** | **1206 ms** | **4197 ms** |
3939

4040
## Summary
4141

42-
- **Rust (html5ever)** total parse time: 304 ms
43-
- **rust-justhtml** total parse time: 53 ms
44-
- **Swift** total parse time: 1314 ms
45-
- **JavaScript** total parse time: 1012 ms
46-
- **Python** total parse time: 4175 ms
42+
- **Rust (html5ever)** total parse time: 302 ms
43+
- **rust-justhtml** total parse time: 696 ms
44+
- **Swift** total parse time: 1319 ms
45+
- **JavaScript** total parse time: 1206 ms
46+
- **Python** total parse time: 4197 ms
4747

48-
**rust-justhtml** is the fastest implementation.
48+
**html5ever** is the fastest implementation.
4949

50-
html5ever is **4.3x faster** than Swift.
51-
html5ever is **0.2x faster** than rust-justhtml.
52-
html5ever is **3.3x faster** than JavaScript.
53-
html5ever is **13.7x faster** than Python.
54-
rust-justhtml is **24.6x faster** than Swift.
55-
rust-justhtml is **78.3x faster** than Python.
50+
html5ever is **4.4x faster** than Swift.
51+
html5ever is **2.3x faster** than rust-justhtml.
52+
html5ever is **4.0x faster** than JavaScript.
53+
html5ever is **13.9x faster** than Python.
54+
rust-justhtml is **1.9x faster** than Swift.
55+
rust-justhtml is **6.0x faster** than Python.
5656

5757
## Test Files
5858

Benchmarks/compare.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,17 @@ def run_rust_justhtml_benchmark():
216216
print(f"rust-justhtml build failed:\n{result.stderr}", file=sys.stderr)
217217
return None
218218

219-
# Run benchmark on each sample file
219+
# Run benchmark on each sample file (including test_files for synthetic.html)
220220
benchmark_binary = rust_justhtml_dir / "target" / "release" / "benchmark"
221221
results = []
222222

223-
for sample in sorted(SAMPLES_DIR.glob("*.html")):
223+
# Collect files from both samples and test_files directories
224+
all_samples = list(SAMPLES_DIR.glob("*.html"))
225+
test_files_dir = SCRIPT_DIR / "test_files"
226+
if test_files_dir.exists():
227+
all_samples.extend(test_files_dir.glob("*.html"))
228+
229+
for sample in sorted(all_samples, key=lambda p: p.name):
224230
result = subprocess.run(
225231
[str(benchmark_binary), "--file", str(sample), "--json"],
226232
capture_output=True,

0 commit comments

Comments
 (0)