11# Benchmarks
22
3- Release measurements for ` native ` vs ` zig ` engines.
3+ Release measurements for ` native ` vs ` zig ` engines on mobile, plus Zig-only
4+ desktop snapshots for experimental macOS and Windows support.
45
56## Environment
67
78- Android: physical ARM64 device, Android 15
89- iOS: physical Apple A15 device, iOS 26.3
10+ - macOS: Apple MacBook Pro 16-inch, M4 Max, 36 GB RAM
11+ - Windows: QEMU 10.0 ARM Virtual Machine, ARM64, 8 GB RAM
912- Build: Release
1013- Payload: generated local cache file, 200 MiB
1114- App settings: ` samples=3 ` , ` warmups=1 `
1215- Values below are medians (` ms ` , lower is better)
1316
14- Each run reports the app-level median for three measured samples. The tables
15- below use the median across repeated runs.
17+ Each run reports the app-level median for three measured samples. When repeated
18+ runs are available, comparison tables use the median across those runs.
1619
1720This document is a current engine-selection snapshot, not a release-to-release
1821speedup table. A slower row means "slower than ` native ` on that platform"; it
1922does not by itself mean the Zig core regressed versus the previous release.
2023
24+ Desktop rows are Zig-only because macOS and Windows support currently ships the
25+ Zig engine only. The Windows numbers were captured in an ARM64 VM, so they are
26+ useful as a release smoke/performance snapshot, not as a hardware comparison
27+ against physical devices.
28+
2129## Key Takeaways
2230
2331- Zig ` v0.0.5 ` improves the Zig path versus the previous benchmark set for
@@ -34,68 +42,106 @@ does not by itself mean the Zig core regressed versus the previous release.
3442 ` SHA-512/256 ` , where the native implementation is much slower.
3543- Android ` native ` is faster for ` SHA-1 ` , ` SHA-384 ` , ` SHA-512 ` , ` BLAKE3 ` ,
3644 and ` XXH3-64 ` in this measurement set.
45+ - Experimental macOS and Windows support produce matching digest prefixes for
46+ the same 200 MiB benchmark payload.
47+ - macOS on M4 Max is currently the fastest measured Zig desktop target, with
48+ ` XXH3-64 ` at 14 ms and ` SHA-256 ` / ` SHA-224 ` / HMAC-SHA-2 224/256 around
49+ 78-79 ms.
50+ - Windows ARM64 VM performs well for ` BLAKE3 ` , ` XXH3-64 ` , ` SHA-1 ` , and the
51+ SHA-512 family, but is much slower than macOS for SHA-224/SHA-256 and their
52+ HMAC variants in this run.
3753
3854## Quick Comparison
3955
4056### iOS
4157
42- | Scenario | Native | Zig | Zig vs native |
43- | ---| ---: | ---:| ---: |
44- | SHA-256, file 200 MiB | 228 | 209 | 9% faster |
45- | SHA-512, file 200 MiB | 317 | 1176 | 271% slower |
46- | BLAKE3, file 200 MiB | 310 | 302 | 3% faster |
47- | XXH3-64, file 200 MiB | 108 | 66 | 39% faster |
58+ | Scenario | Native | Zig | Zig vs native |
59+ | --------------------- | -----: | ---: | ------------: |
60+ | SHA-256, file 200 MiB | 228 | 209 | 9% faster |
61+ | SHA-512, file 200 MiB | 317 | 1176 | 271% slower |
62+ | BLAKE3, file 200 MiB | 310 | 302 | 3% faster |
63+ | XXH3-64, file 200 MiB | 108 | 66 | 39% faster |
4864
4965### Android
5066
51- | Scenario | Native | Zig | Zig vs native |
52- | ---| ---:| ---:| ---:|
53- | SHA-256, file 200 MiB | 297 | 332 | 12% slower |
54- | SHA-512/224, file 200 MiB | 3832 | 796 | 79% faster |
55- | BLAKE3, file 200 MiB | 304 | 391 | 29% slower |
56- | XXH3-64, file 200 MiB | 73 | 96 | 32% slower |
67+ | Scenario | Native | Zig | Zig vs native |
68+ | ------------------------- | -----: | --: | ------------: |
69+ | SHA-256, file 200 MiB | 297 | 332 | 12% slower |
70+ | SHA-512/224, file 200 MiB | 3832 | 796 | 79% faster |
71+ | BLAKE3, file 200 MiB | 304 | 391 | 29% slower |
72+ | XXH3-64, file 200 MiB | 73 | 96 | 32% slower |
73+
74+ ### Desktop Zig
75+
76+ | Scenario | macOS M4 Max | Windows ARM64 VM |
77+ | --------------------- | -----------: | ---------------: |
78+ | SHA-256, file 200 MiB | 79.0 | 539 |
79+ | SHA-512, file 200 MiB | 295 | 332 |
80+ | BLAKE3, file 200 MiB | 102 | 125 |
81+ | XXH3-64, file 200 MiB | 14.0 | 28.0 |
5782
5883## Full Matrix: iOS 200 MiB
5984
60- | Algorithm | Native | Zig | Zig vs native |
61- | ---| ---: | ---:| ---: |
62- | SHA-256 | 228 | 209 | 9% faster |
63- | MD5 | 587 | 561 | 5% faster |
64- | SHA-1 | 222 | 552 | 149% slower |
65- | SHA-224 | 227 | 207 | 9% faster |
66- | SHA-384 | 316 | 1177 | 272% slower |
67- | SHA-512 | 317 | 1176 | 271% slower |
68- | SHA-512/224 | 315 | 1175 | 273% slower |
69- | SHA-512/256 | 313 | 1173 | 275% slower |
70- | HMAC-SHA-224 | 223 | 204 | 9% faster |
71- | HMAC-SHA-256 | 223 | 207 | 7% faster |
72- | HMAC-SHA-384 | 315 | 1173 | 272% slower |
73- | HMAC-SHA-512 | 314 | 1174 | 274% slower |
74- | HMAC-MD5 | 586 | 556 | 5% faster |
75- | HMAC-SHA-1 | 214 | 549 | 157% slower |
76- | BLAKE3 | 310 | 302 | 3% faster |
77- | XXH3-64 | 108 | 66 | 39% faster |
85+ | Algorithm | Native | Zig | Zig vs native |
86+ | ------------ | -----: | ---: | ------------: |
87+ | SHA-256 | 228 | 209 | 9% faster |
88+ | MD5 | 587 | 561 | 5% faster |
89+ | SHA-1 | 222 | 552 | 149% slower |
90+ | SHA-224 | 227 | 207 | 9% faster |
91+ | SHA-384 | 316 | 1177 | 272% slower |
92+ | SHA-512 | 317 | 1176 | 271% slower |
93+ | SHA-512/224 | 315 | 1175 | 273% slower |
94+ | SHA-512/256 | 313 | 1173 | 275% slower |
95+ | HMAC-SHA-224 | 223 | 204 | 9% faster |
96+ | HMAC-SHA-256 | 223 | 207 | 7% faster |
97+ | HMAC-SHA-384 | 315 | 1173 | 272% slower |
98+ | HMAC-SHA-512 | 314 | 1174 | 274% slower |
99+ | HMAC-MD5 | 586 | 556 | 5% faster |
100+ | HMAC-SHA-1 | 214 | 549 | 157% slower |
101+ | BLAKE3 | 310 | 302 | 3% faster |
102+ | XXH3-64 | 108 | 66 | 39% faster |
78103
79104## Full Matrix: Android 200 MiB
80105
81- | Algorithm | Native | Zig | Zig vs native |
82- | ---| ---:| ---:| ---:|
83- | SHA-256 | 297 | 332 | 12% slower |
84- | MD5 | 585 | 605 | 3% slower |
85- | SHA-1 | 228 | 581 | 155% slower |
86- | SHA-224 | 222 | 227 | 2% slower |
87- | SHA-384 | 552 | 818 | 48% slower |
88- | SHA-512 | 549 | 808 | 47% slower |
89- | SHA-512/224 | 3832 | 796 | 79% faster |
90- | SHA-512/256 | 3868 | 795 | 79% faster |
91- | HMAC-SHA-224 | 222 | 227 | 2% slower |
92- | HMAC-SHA-256 | 222 | 225 | 1% slower |
93- | HMAC-SHA-384 | 553 | 792 | 43% slower |
94- | HMAC-SHA-512 | 553 | 797 | 44% slower |
95- | HMAC-MD5 | 581 | 588 | 1% slower |
96- | HMAC-SHA-1 | 229 | 557 | 143% slower |
97- | BLAKE3 | 304 | 391 | 29% slower |
98- | XXH3-64 | 73 | 96 | 32% slower |
106+ | Algorithm | Native | Zig | Zig vs native |
107+ | ------------ | -----: | --: | ------------: |
108+ | SHA-256 | 297 | 332 | 12% slower |
109+ | MD5 | 585 | 605 | 3% slower |
110+ | SHA-1 | 228 | 581 | 155% slower |
111+ | SHA-224 | 222 | 227 | 2% slower |
112+ | SHA-384 | 552 | 818 | 48% slower |
113+ | SHA-512 | 549 | 808 | 47% slower |
114+ | SHA-512/224 | 3832 | 796 | 79% faster |
115+ | SHA-512/256 | 3868 | 795 | 79% faster |
116+ | HMAC-SHA-224 | 222 | 227 | 2% slower |
117+ | HMAC-SHA-256 | 222 | 225 | 1% slower |
118+ | HMAC-SHA-384 | 553 | 792 | 43% slower |
119+ | HMAC-SHA-512 | 553 | 797 | 44% slower |
120+ | HMAC-MD5 | 581 | 588 | 1% slower |
121+ | HMAC-SHA-1 | 229 | 557 | 143% slower |
122+ | BLAKE3 | 304 | 391 | 29% slower |
123+ | XXH3-64 | 73 | 96 | 32% slower |
124+
125+ ## Full Matrix: Desktop Zig 200 MiB
126+
127+ | Algorithm | macOS M4 Max | macOS range | Windows ARM64 VM | Windows range |
128+ | ------------ | -----------: | ----------: | ---------------: | ------------: |
129+ | SHA-256 | 79.0 | 79.0-79.0 | 539 | 516-636 |
130+ | MD5 | 238 | 238-239 | 285 | 269-289 |
131+ | SHA-1 | 171 | 169-171 | 201 | 198-205 |
132+ | SHA-224 | 79.0 | 78.0-79.0 | 496 | 496-504 |
133+ | SHA-384 | 295 | 293-295 | 335 | 333-362 |
134+ | SHA-512 | 295 | 293-296 | 332 | 331-337 |
135+ | SHA-512/224 | 296 | 295-296 | 347 | 329-365 |
136+ | SHA-512/256 | 296 | 295-297 | 349 | 340-525 |
137+ | HMAC-SHA-224 | 78.0 | 78.0-79.0 | 502 | 493-515 |
138+ | HMAC-SHA-256 | 78.0 | 78.0-78.0 | 505 | 503-508 |
139+ | HMAC-SHA-384 | 297 | 293-299 | 349 | 340-374 |
140+ | HMAC-SHA-512 | 297 | 295-298 | 338 | 332-339 |
141+ | HMAC-MD5 | 239 | 238-246 | 269 | 266-269 |
142+ | HMAC-SHA-1 | 172 | 172-172 | 202 | 200-203 |
143+ | BLAKE3 | 102 | 102-103 | 125 | 125-126 |
144+ | XXH3-64 | 14.0 | 14.0-15.0 | 28.0 | 28.0-30.0 |
99145
100146## Notes
101147
0 commit comments