Skip to content

Commit 979853e

Browse files
jqueguinerclaude
andcommitted
docs: publish RAM + CPU footprint comparison (Rust vs Python)
Whole-process real-names benchmark: peak RAM ~0.43GB vs ~1.27GB (~3x less), CPU time 3.0s vs 45.5s (~15x less), measured with /usr/bin/time -v. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2f386d9 commit 979853e

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ indicative only.
7373

7474
\* Not identical logic — Rust port vs upstream faker `first_name`.
7575

76+
### Resource usage
77+
78+
Whole-process footprint of the real-names benchmark (load the 1.43M-name bank,
79+
then 3M ops), measured with `/usr/bin/time -v`:
80+
81+
| Metric | Python | Rust (release) | Ratio |
82+
|---|---:|---:|---:|
83+
| Peak RAM (RSS) | ~1.27 GB | ~0.43 GB | ~3.0× less |
84+
| CPU time (user+sys) | 45.5 s | 3.0 s | ~15× less |
85+
| Wall clock | 38.3 s | 3.0 s | ~13× less |
86+
87+
RAM is dominated by the in-memory name index (per-country + global pools).
88+
Both hold the full 1.43M-row dataset resident; Rust's compact `HashMap` +
89+
`String` storage uses ~3× less than the Python `dict` structures + interpreter.
90+
7691
Reproduce:
7792

7893
```bash

rust/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ f.first_name_real(Some("JP"), Gender::Female); // weighted female JP name
9797
| `first_name_like_real` | 3.79 M ops/s | 0.84 M ops/s |
9898
| bank load (1.43M rows) | 2.3 s | 8.9 s |
9999

100-
~4–5× faster on identical logic. See top-level `README.md` for the full table.
100+
~4–5× faster on identical logic. Whole-process footprint (load bank + 3M ops):
101+
peak RAM ~0.43 GB vs Python ~1.27 GB (~3× less), CPU time 3.0s vs 45.5s
102+
(~15× less). See top-level `README.md` for the full tables.
101103

102104
## Grammatical number agreement
103105

0 commit comments

Comments
 (0)