Skip to content

Commit 7bcab4f

Browse files
kylehowellsclaude
andcommitted
Fix Swift product name in memory_compare.py
Changed import from 'JustHTML' to 'justhtml' and product name from 'swift-justhtml' to 'justhtml' to match Package.swift. Memory results: - Rust: 42 MB avg (baseline) - Swift: 103 MB avg (2.45x more) - Python: 106 MB avg (2.52x more) - JavaScript: 226 MB avg (5.37x more) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent c1eb873 commit 7bcab4f

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

Benchmarks/MEMORY_RESULTS.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
# Memory Usage Comparison
22

3-
**Generated:** 2025-12-17 19:54:09
3+
**Generated:** 2025-12-18 10:02:36
44

55
## Repository Versions
66

77
| Project | Commit |
88
|---------|--------|
9-
| swift-justhtml | `2e01d93a6cd5` |
9+
| swift-justhtml | `c1eb87378893` |
1010
| justhtml (Python) | `63c29b26be64` |
1111
| justjshtml (JavaScript) | `e29dbd3166e9` |
12+
| html5ever (Rust) | `795caf4166a8` |
1213

1314
## Peak Memory Usage (RSS)
1415

15-
| File | Size | Swift | Python | JavaScript | Swift vs Python | Swift vs JS |
16-
|------|------|-------|--------|------------|-----------------|-------------|
17-
| hackernews.html | 33.67 KB | 19.77 MB | 14.73 MB | 58.80 MB | 1.34x more | 2.98x less |
18-
| synthetic.html | 20.02 MB | 475.09 MB | 505.55 MB | 866.20 MB | 1.06x less | 1.82x less |
19-
| wikipedia_countries.html | 360.45 KB | 26.35 MB | 22.86 MB | 90.63 MB | 1.15x more | 3.44x less |
20-
| wikipedia_html.html | 472.45 KB | 27.95 MB | 24.87 MB | 91.56 MB | 1.12x more | 3.28x less |
21-
| wikipedia_swift.html | 410.54 KB | 26.93 MB | 24.44 MB | 90.68 MB | 1.10x more | 3.37x less |
22-
| wikipedia_ww2.html | 1.18 MB | 40.15 MB | 42.68 MB | 155.99 MB | 1.06x less | 3.89x less |
16+
| File | Size | Rust | Swift | JavaScript | Python | Rust vs Swift |
17+
|------|------|------|-------|------------|--------|---------------|
18+
| hackernews.html | 33.67 KB | 3.18 MB | 19.79 MB | 59.10 MB | 14.68 MB | 6.22x less |
19+
| synthetic.html | 20.02 MB | 216.40 MB | 475.22 MB | 863.95 MB | 505.52 MB | 2.20x less |
20+
| wikipedia_countries.html | 360.45 KB | 6.07 MB | 26.45 MB | 90.53 MB | 22.87 MB | 4.36x less |
21+
| wikipedia_html.html | 472.45 KB | 7.13 MB | 28.32 MB | 94.62 MB | 25.00 MB | 3.97x less |
22+
| wikipedia_swift.html | 410.54 KB | 6.69 MB | 26.80 MB | 90.43 MB | 24.52 MB | 4.01x less |
23+
| wikipedia_ww2.html | 1.18 MB | 12.52 MB | 40.18 MB | 155.27 MB | 42.46 MB | 3.21x less |
2324

2425
## Summary
2526

2627
Average peak memory usage across 6 files:
2728

28-
- **Swift**: 102.71 MB
29-
- **Python**: 105.85 MB
30-
- **JavaScript**: 225.64 MB
29+
- **Rust (html5ever)**: 42.00 MB
30+
- **Swift**: 102.79 MB
31+
- **JavaScript**: 225.65 MB
32+
- **Python**: 105.84 MB
3133

32-
Swift uses **1.03x less memory** than Python on average.
33-
Swift uses **2.20x less memory** than JavaScript on average.
34+
Rust uses **2.45x less memory** than Swift on average.
35+
Rust uses **5.37x less memory** than JavaScript on average.
36+
Rust uses **2.52x less memory** than Python on average.
3437

3538
*Note: Memory measurements are peak RSS (Resident Set Size) which includes shared libraries and may vary between runs.*

Benchmarks/memory_compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def measure_swift_memory_simple(filepath):
198198
main_swift = sources_dir / "main.swift"
199199
main_swift.write_text(f'''
200200
import Foundation
201-
import JustHTML
201+
import justhtml
202202
203203
let url = URL(fileURLWithPath: "{filepath}")
204204
let html = try! String(contentsOf: url, encoding: .utf8)
@@ -220,7 +220,7 @@ def measure_swift_memory_simple(filepath):
220220
.executableTarget(
221221
name: "MemTest",
222222
dependencies: [
223-
.product(name: "swift-justhtml", package: "swift-justhtml"),
223+
.product(name: "justhtml", package: "swift-justhtml"),
224224
]
225225
),
226226
]

0 commit comments

Comments
 (0)