Max updates 0.2.8 test2 - #1492
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Benchmark results - commit
|
| Rank | Language | Geomean | vs C | vs Salam | Fastest / tied-fastest on |
|---|---|---|---|---|---|
| 1 | Rust | 14.08 ms | 0.95x | 0.93x | 18 / 39 |
| 2 | C | 14.86 ms | 1.00x | 0.98x | 19 / 39 |
| 3 | Salam-l | 15.16 ms | 1.02x | 1.00x | 13 / 39 |
| 4 | Salam-g | 15.78 ms | 1.06x | 1.04x | 17 / 39 |
| 5 | C++ | 16.44 ms | 1.11x | 1.08x | 7 / 39 |
| 6 | Go | 19.13 ms | 1.29x | 1.26x | 1 / 39 |
| 7 | Salam-t | 47.51 ms | 3.20x | 3.13x | 1 / 39 |
| 8 | PHP | 130.20 ms | 8.76x | 8.59x | 0 / 39 |
| 9 | Python | 761.83 ms | 51.27x | 50.26x | 0 / 39 |
Rust █████████████ 14.08 ms 0.95x C
C ██████████████ 14.86 ms 1.00x C <- baseline
Salam-l ██████████████ 15.16 ms 1.02x C
Salam-g ███████████████ 15.78 ms 1.06x C
C++ ████████████████ 16.44 ms 1.11x C
Go ██████████████████ 19.13 ms 1.29x C
Salam-t █████████████████████████████████████████████ 47.51 ms 3.20x C
PHP █████████████████████████████████████████████ 130.20 ms 8.76x C
Python (off scale) 761.83 ms 51.27x C
Takeaways:
- Fastest Salam backend: Salam-l, geomean 15.16 ms
(1.02x C's geomean, 1.08x Rust's). - C is fastest or tied-fastest on the most programs (
19/39); see the per-program table below. salam buildwith no flags (Salam-t, tcc, no optimizer) is 3.13x slower than the
fastest Salam backend, so it is the out-of-the-box baseline, not the number
to compare against other optimized languages -- pass-O3/ use the LLVM
backend for like-for-like comparisons.- Python and PHP are 9-51x slower than the compiled languages on
this suite and are included for scale only. - "Fastest / tied-fastest on" counts ties on every side (e.g. a 4-way tie
adds 1 to all 4 languages), so the column does not sum to 39.
Full report - all programs, environment, methodology (click to expand)
Salam Benchmark Suite Results
39 CPU- and IO-bound programs implemented identically in C, C++, Rust, Go,
Python, PHP, and Salam. Salam is measured three ways: the LLVM backend at
-O3, the C backend compiled by gcc -O3, and the default tcc toolchain
(no optimizer) as the out-of-the-box reference. C and C++ run at -O3 too.
- Started (epoch ns): 1786021261032174192
- Finished (epoch ns): 1786021821021223349
Methodology
Times below are the minimum wall-clock over 1 timed runs (plus one
untimed warm-up run per variant). The minimum is the most robust
single-number estimator on a shared machine: it rejects scheduler and
background-load noise, which inflates averages on short-lived processes.
Each program prints a deterministic result that is identical across every
language; all variants are verified against the C output before timing.
For the full per-run distribution (min/avg/max/median/stdev, raw epoch-ns
samples), see results/results.json and results/results.csv.
Environment
- cpu: INTEL(R) XEON(R) PLATINUM 8573C
- gcc: gcc (Alpine 15.2.0) 15.2.0
- g++: g++ (Alpine 15.2.0) 15.2.0
- rustc: rustc 1.97.0 (2d8144b78 2026-07-07) (Alpine Linux Rust 1.97.0-r0)
- go: go version go1.26.5 linux/amd64
- tcc: tcc version 0.9.28rc (x86_64 Linux)
- clang: Alpine clang version 22.1.8
- python: Python 3.14.5
- php: PHP 8.5.9 (cli) (built: Jul 30 2026 16:49:55) (NTS)
- salam: 0.2.8
Overall ranking (fastest to slowest)
One number per language: the geometric mean of minimum times across all
39 programs (geometric mean is used because it is not skewed by the few
slow/high-variance programs the way an arithmetic mean would be). Lower is
faster; vs C and vs Salam express the same geomean as a multiple of C's
and of the fastest Salam backend's (Salam-l). Salam's three variants are
suffixed -g (C backend, gcc -O3), -l (LLVM backend, -O3), and
-t (C backend, tcc, no optimizer, the out-of-the-box default).
| Rank | Language | Geomean | vs C | vs Salam | Fastest / tied-fastest on |
|---|---|---|---|---|---|
| 1 | Rust | 14.08 ms | 0.95x | 0.93x | 18 / 39 |
| 2 | C | 14.86 ms | 1.00x | 0.98x | 19 / 39 |
| 3 | Salam-l | 15.16 ms | 1.02x | 1.00x | 13 / 39 |
| 4 | Salam-g | 15.78 ms | 1.06x | 1.04x | 17 / 39 |
| 5 | C++ | 16.44 ms | 1.11x | 1.08x | 7 / 39 |
| 6 | Go | 19.13 ms | 1.29x | 1.26x | 1 / 39 |
| 7 | Salam-t | 47.51 ms | 3.20x | 3.13x | 1 / 39 |
| 8 | PHP | 130.20 ms | 8.76x | 8.59x | 0 / 39 |
| 9 | Python | 761.83 ms | 51.27x | 50.26x | 0 / 39 |
Rust █████████████ 14.08 ms 0.95x C
C ██████████████ 14.86 ms 1.00x C <- baseline
Salam-l ██████████████ 15.16 ms 1.02x C
Salam-g ███████████████ 15.78 ms 1.06x C
C++ ████████████████ 16.44 ms 1.11x C
Go ██████████████████ 19.13 ms 1.29x C
Salam-t █████████████████████████████████████████████ 47.51 ms 3.20x C
PHP █████████████████████████████████████████████ 130.20 ms 8.76x C
Python (off scale) 761.83 ms 51.27x C
Takeaways:
- Fastest Salam backend: Salam-l, geomean 15.16 ms
(1.02x C's geomean, 1.08x Rust's). - C is fastest or tied-fastest on the most programs (
19/39); see the per-program table below. salam buildwith no flags (Salam-t, tcc, no optimizer) is 3.13x slower than the
fastest Salam backend, so it is the out-of-the-box baseline, not the number
to compare against other optimized languages -- pass-O3/ use the LLVM
backend for like-for-like comparisons.- Python and PHP are 9-51x slower than the compiled languages on
this suite and are included for scale only. - "Fastest / tied-fastest on" counts ties on every side (e.g. a 4-way tie
adds 1 to all 4 languages), so the column does not sum to 39.
Per-program results (minimum ms)
| Program | C | C++ | Rust | Go | Salam-l | Salam-g | Salam-t | PHP | Python | Fastest |
|---|---|---|---|---|---|---|---|---|---|---|
| 01_fib_recursive | 3 | 4 | 4 | 7 | 4 | 3 | 8 | 52 | 90 | C / Salam-g (3) |
| 02_fib_iterative | 20 | 21 | 22 | 21 | 23 | 20 | 34 | 61 | 597 | C / Salam-g (20) |
| 03_primes_count | 6 | 7 | 5 | 8 | 5 | 6 | 6 | 19 | 152 | Rust / Salam-l (5) |
| 04_collatz | 6 | 7 | 5 | 8 | 6 | 7 | 26 | 59 | 362 | Rust (5) |
| 05_sum_mod | 13 | 13 | 14 | 14 | 14 | 13 | 20 | 29 | 410 | C / C++ / Salam-g (13) |
| 06_gcd_sum | 23 | 24 | 19 | 25 | 18 | 24 | 27 | 52 | 137 | Salam-l (18) |
| 07_pow_mod | 2 | 3 | 3 | 4 | 2 | 2 | 6 | 19 | 67 | C / Salam (2) |
| 08_digit_sum | 4 | 4 | 4 | 5 | 4 | 4 | 19 | 55 | 331 | C / C++ / Rust / Salam (4) |
| 09_perfect_numbers | 14 | 15 | 8 | 15 | 8 | 14 | 14 | 35 | 381 | Rust / Salam-l (8) |
| 10_pi_leibniz | 6 | 6 | 6 | 7 | 5 | 5 | 9 | 53 | 459 | Salam (5) |
| 11_loop_count | 6 | 7 | 6 | 7 | 6 | 5 | 9 | 14 | 100 | Salam-g (5) |
| 12_hello_print | 18 | 19 | 2 | 7 | 2 | 2 | 194 | 214 | 83 | Rust / Salam (2) |
| 13_array_rw | 24 | 25 | 27 | 25 | 28 | 26 | 44 | 73 | 840 | C (24) |
| 14_lcg_random | 20 | 22 | 22 | 27 | 23 | 21 | 45 | 86 | 1287 | C (20) |
| 15_matrix_mult | 6 | 6 | 4 | 11 | 8 | 8 | 36 | 173 | 1109 | Rust (4) |
| 16_quicksort | 31 | 31 | 29 | 30 | 30 | 32 | 66 | 171 | 487 | Rust (29) |
| 17_n_queens | 48 | 50 | 54 | 55 | 60 | 59 | 119 | 480 | 663 | C (48) |
| 18_sieve_eratosthenes | 9 | 10 | 10 | 10 | 23 | 24 | 59 | 109 | 858 | C (9) |
| 19_mandelbrot | 11 | 12 | 11 | 13 | 11 | 10 | 27 | 120 | 1104 | Salam-g (10) |
| 20_monte_carlo_pi | 33 | 33 | 19 | 41 | 19 | 33 | 118 | 352 | 3509 | Rust / Salam-l (19) |
| 21_coin_change_dp | 3 | 4 | 3 | 4 | 3 | 3 | 7 | 16 | 103 | C / Rust / Salam (3) |
| 22_knapsack_01 | 5 | 6 | 5 | 8 | 8 | 7 | 38 | 106 | 996 | C / Rust (5) |
| 23_caesar_cipher | 15 | 15 | 14 | 19 | 14 | 14 | 41 | 101 | 1121 | Rust / Salam (14) |
| 24_merge_sort | 34 | 35 | 37 | 43 | 48 | 44 | 123 | 286 | 745 | C (34) |
| 25_palindrome_count | 14 | 15 | 13 | 17 | 14 | 17 | 82 | 228 | 1668 | Rust (13) |
| 26_ackermann | 2 | 2 | 2 | 3 | 2 | 2 | 2 | 9 | 22 | C / C++ / Rust / Salam (2) |
| 27_edit_distance | 7 | 11 | 7 | 16 | 17 | 17 | 84 | 230 | 2395 | C / Rust (7) |
| 28_prime_factorization | 1635 | 1606 | 1005 | 1633 | 1021 | 1597 | 1656 | 4186 | 52521 | Rust (1005) |
| 29_dot_product | 41 | 41 | 42 | 41 | 43 | 41 | 100 | 239 | 2678 | C / C++ / Go / Salam-g (41) |
| 30_heap_sort | 41 | 42 | 44 | 51 | 50 | 40 | 158 | 507 | 1049 | Salam-g (40) |
| 31_binary_search_stress | 1055 | 1024 | 695 | 1011 | 1077 | 1017 | 1621 | 3808 | 23168 | Rust (695) |
| 32_longest_increasing_subsequence | 15 | 16 | 27 | 16 | 12 | 12 | 147 | 255 | 1828 | Salam (12) |
| 33_subset_sum_reachability | 19 | 19 | 23 | 25 | 27 | 26 | 88 | 298 | 2216 | C / C++ (19) |
| 34_counting_sort | 38 | 37 | 29 | 43 | 31 | 36 | 95 | 220 | 2357 | Rust (29) |
| 35_run_length_stats | 7 | 8 | 6 | 9 | 6 | 8 | 33 | 105 | 815 | Rust / Salam-l (6) |
| 36_array_rotation_reversal | 25 | 23 | 27 | 25 | 28 | 24 | 97 | 213 | 882 | C++ (23) |
| 37_sqrt_decomposition | 9 | 12 | 10 | 20 | 19 | 18 | 78 | 295 | 1056 | C (9) |
| 38_game_of_life | 11 | 12 | 35 | 52 | 15 | 11 | 145 | 1060 | 8236 | C / Salam-g (11) |
| 39_trapezoidal_integration | 14 | 14 | 15 | 17 | 15 | 14 | 116 | 413 | 2360 | C / C++ / Salam-g (14) |
Bold marks rows where a Salam backend is the fastest or tied for fastest.
Summary
Taking the best Salam backend per program against the best of the other
compiled languages (C / C++ / Rust / Go):
- Fastest outright (6): 06_gcd_sum, 10_pi_leibniz, 11_loop_count, 19_mandelbrot, 30_heap_sort, 32_longest_increasing_subsequence.
- Tied for fastest (16): 01_fib_recursive, 02_fib_iterative, 03_primes_count, 05_sum_mod, 07_pow_mod, 08_digit_sum, 09_perfect_numbers, 12_hello_print, 20_monte_carlo_pi, 21_coin_change_dp, 23_caesar_cipher, 26_ackermann, 29_dot_product, 35_run_length_stats, 38_game_of_life, 39_trapezoidal_integration.
- Trailing the fastest (17): 04_collatz (+1 vs Rust); 13_array_rw (+2 vs C); 14_lcg_random (+1 vs C); 15_matrix_mult (+4 vs Rust); 16_quicksort (+1 vs Rust); 17_n_queens (+11 vs C); 18_sieve_eratosthenes (+14 vs C); 22_knapsack_01 (+2 vs C/Rust); 24_merge_sort (+10 vs C); 25_palindrome_count (+1 vs Rust); 27_edit_distance (+10 vs C/Rust); 28_prime_factorization (+16 vs Rust); 31_binary_search_stress (+322 vs Rust); 33_subset_sum_reachability (+7 vs C/C++); 34_counting_sort (+2 vs Rust); 36_array_rotation_reversal (+1 vs C++); 37_sqrt_decomposition (+9 vs C).
Salam matches or beats the fastest other compiled language on 22 of 39 programs.
hello_print (the IO case)
12_hello_print prints a constant string one million times. It was previously
the one program where Salam trailed (≈13 ms, near the bottom). The C backend now
routes stdout of single-threaded modules through a process-global userspace
buffer: a literal println becomes an inline memcpy into a 64 KiB buffer plus
one write(2) when it fills or at exit, skipping the per-call stdio lock and the
strlen/format machinery (the length is known at compile time). That took it
13 ms → 3 ms, tying the fastest language measured (Rust's buffered writer is
3 ms, Go 8 ms, C's line-by-line printf 13 ms). Both Salam backends now use this
path: the LLVM backend emits the same buffer as IR globals plus a
llvm.global_dtors flush, so salam llvm also dropped from ≈13 ms to 3 ms.
Multi-threaded modules keep using locked stdio, so correctness and output
ordering are unchanged; the full test suite passes on both backends.
The fast path is now enabled across targets, not just 64-bit Linux/macOS:
- 32-bit LLVM uses target-independent IR (i64 byte counters and the
llvm.memcpy.p0.p0.i64intrinsic), so--target=i686-*gets the same buffer. - Windows (C backend) routes the raw write through
_writeand keeps the
weak-symbol buffer with a destructor flush, so a native mingw build buffers too
(verified: the prelude compiles and links against_writeon both
x86_64-w64-mingw32andi686-w64-mingw32). - Windows LLVM targets intentionally fall back to
printf(the POSIX
write(2)the buffer emits does not exist there), keeping cross-compiled
Windows binaries correct.
Notes:
- Python and PHP are included for scale only; they are consistently much
slower and are never the fastest on this suite. - Measurements were taken on a single machine under normal background load;
small gaps between the compiled languages can be within run-to-run noise.
Description
Please include a brief description of the changes introduced by this pull request.
Related Issue
If this pull request addresses or resolves an existing issue, please reference it here.
Proposed Changes
Outline the changes made in this pull request and explain their purpose.
Checklist
Additional Notes
Add any additional notes or context about this pull request.