File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,31 @@ cargo test --features real-names # opt-in parquet ground truth
5757
5858See [ ` rust/README.md ` ] ( rust/README.md ) .
5959
60+ ## Benchmarks
61+
62+ Rust (release) vs Python, 1,000,000 operations each. The real-names rows run the
63+ ** same algorithm** on both sides (apples-to-apples); "basic name gen" compares
64+ the Rust port against upstream faker's heavier code path, so treat it as
65+ indicative only.
66+
67+ | Task (1M ops) | Python | Rust (release) | Speedup |
68+ | ---| ---:| ---:| ---:|
69+ | ` infer_gender ` (real, 139 countries) | 2.79 M ops/s | 12.79 M ops/s | ~ 4.6× |
70+ | ` first_name_like ` (real, freq-weighted) | 0.84 M ops/s | 3.79 M ops/s | ~ 4.5× |
71+ | parquet bank load (1.43M rows, one-time) | 8.9 s | 2.3 s | ~ 3.9× |
72+ | basic name generation | 0.037 M ops/s | 11.90 M ops/s | ~ 320× \* |
73+
74+ \* Not identical logic — Rust port vs upstream faker ` first_name ` .
75+
76+ Reproduce:
77+
78+ ``` bash
79+ # Rust
80+ cd rust && cargo run --release --features real-names --example bench
81+ # Python
82+ PYTHONPATH=. python3 scripts/bench_naming.py
83+ ```
84+
6085## Data provenance
6186
6287The name dataset was extracted from a PostgreSQL dump and normalized so
Original file line number Diff line number Diff line change @@ -87,6 +87,18 @@ f.first_name_real(Some("JP"), Gender::Female); // weighted female JP name
8787- Pulls in ` parquet ` + ` arrow ` (only under this feature).
8888- Dataset path overridable via ` FAKER2_NAMES_PARQUET ` .
8989
90+ ### Benchmark
91+
92+ ` cargo run --release --features real-names --example bench ` (1M ops):
93+
94+ | Task | Rust (release) | Python |
95+ | ---| ---:| ---:|
96+ | ` infer_gender_real ` | 12.79 M ops/s | 2.79 M ops/s |
97+ | ` first_name_like_real ` | 3.79 M ops/s | 0.84 M ops/s |
98+ | bank load (1.43M rows) | 2.3 s | 8.9 s |
99+
100+ ~ 4–5× faster on identical logic. See top-level ` README.md ` for the full table.
101+
90102## Grammatical number agreement
91103
92104``` rust
You can’t perform that action at this time.
0 commit comments