Navigation
Syntax Guide
Learn Logic
StudioCratesRoadmapContactNewsBenchmarks
GitHub

Benchmarks

LOGOS runs six ways: compiled through Rust, compiled to C from the program and from its bytecode, on our x86-64 JIT, on the bytecode VM, and on the tree-walking interpreter. Here is each one against the languages people pick when speed matters, from programs with English-level readability.

v0.11.0a16eceecbIntel(R) Core(TM) i9-14900KUbuntu 24.04.2 LTS x86_642026-11-02Pinned to CPUs 0-15Raw JSON⬇ Flamegraph PDF
LOGOS (Rust)
4.16×
the speed of C, geometric mean
1.49× where every language runs the same algorithm
35 of 35 benchmarks
LOGOS (C)
2.08×
the speed of C, geometric mean
0.92× where every language runs the same algorithm
35 of 35 benchmarks
LOGOS (C, bytecode)
1.18×
the speed of C, geometric mean
0.43× where every language runs the same algorithm
35 of 35 benchmarks
LOGOS (JIT)
0.62×
the speed of C, geometric mean
0.40× where every language runs the same algorithm
35 of 35 benchmarks
LOGOS (VM)
0.03×
the speed of C, geometric mean
0.02× where every language runs the same algorithm
35 of 35 benchmarks
LOGOS (tree-walker)
0.01×
the speed of C, geometric mean
0.01× where every language runs the same algorithm
35 of 35 benchmarks

Benchmarks are easy to rig, so we've tried to make ours easy to check. Every program on this page computes the same answer in every language, byte for byte, at every size we time, and every number comes out of one script you can run on your own machine. LOGOS shows up once for every way it runs: compiled through Rust, compiled to C from the program and from its bytecode, on our x86-64 JIT, on the bytecode VM alone, and on the tree-walking interpreter. Each one's output is in the panel under the source, so you can read what actually ran.

Sometimes the compiler wins by doing less work, like folding a recursion into a closed form. Those benchmarks are marked ⚡, the second number on each card leaves them out, and the generated code is right there to read. A faster algorithm and faster machine code are two different claims, and we'd rather you didn't have to take our word for either.

Merge Sort
Top-down merge sort. (n = 3000000)
Wall-clock time at n = 3000000 — shorter bar is faster.
LOGOS
LOGOS (Rust)
211.7ms
LOGOS (C)
440.4ms
LOGOS (C, bytecode)
795.7ms
LOGOS (JIT)
813.8ms
LOGOS (VM)
10.98s
LOGOS (tree-walker)
timed out (>5min)
Systems
C (clang)
200.7ms
C++ (clang)
213.4ms
Rust
227.3ms
C (gcc)
229.6ms
C++ (gcc)
248.1ms
Zig
263.4ms
Managed
Go
302.2ms
Java
378.0ms
JavaScript
493.2ms
Transpiled
Nim
260.9ms
Scaling — time vs problem size (log–log)
10.98s2.8msn=50kn=100kn=3MC (gcc)C (clang)C++ (gcc)C++ (clang)RustZigGoJavaJavaScriptNimLOGOS (Rust)LOGOS (C)LOGOS (C, bytecode)LOGOS (JIT)LOGOS (VM)LOGOS (tree-walker)
LOGOS (tree-walker)
LOGOS (VM)
LOGOS (JIT)
LOGOS (C, bytecode)
LOGOS (C)
LOGOS (Rust)
Nim
JavaScript
Java
Go
Zig
Rust
C++ (clang)
C++ (gcc)
C (clang)
C (gcc)
Complexity
time O(n log n)space O(n)
Measured time growth
C (gcc)t ≈ n^1.02
C (clang)t ≈ n^1.05
C++ (gcc)t ≈ n^1.01
C++ (clang)t ≈ n^1.03
Rustt ≈ n^1.02
Zigt ≈ n^1.05
Got ≈ n^1.00
Javat ≈ n^0.63
JavaScriptt ≈ n^0.75
Nimt ≈ n^1.02
LOGOS (Rust)t ≈ n^1.04
LOGOS (C)t ≈ n^1.02
LOGOS (C, bytecode)t ≈ n^1.09
LOGOS (JIT)t ≈ n^1.01
LOGOS (VM)t ≈ n^1.05
LOGOS (tree-walker)t ≈ n^1.06
Measured space growth
C (gcc)rss ≈ n^0.86
C (clang)rss ≈ n^0.81
C++ (gcc)rss ≈ n^0.72
C++ (clang)rss ≈ n^0.73
Rustrss ≈ n^0.81
Zigrss ≈ n^0.99
Gorss ≈ n^0.80
Javarss ≈ n^0.58
JavaScriptrss ≈ n^0.38
Nimrss ≈ n^0.82
LOGOS (Rust)rss ≈ n^0.81
LOGOS (C)rss ≈ n^0.79
LOGOS (C, bytecode)rss ≈ n^0.88
LOGOS (JIT)rss ≈ n^0.60
LOGOS (VM)rss ≈ n^0.33
LOGOS (tree-walker)rss ≈ n^0.12
Memory — peak resident set size
Peak resident memory at n = 3000000 — shorter bar uses less.
Zig
68.8 MB
C (gcc)
69.8 MB
C (clang)
70.2 MB
LOGOS (Rust)
70.2 MB
Rust
70.3 MB
Nim
70.5 MB
C++ (clang)
71.4 MB
C++ (gcc)
71.8 MB
LOGOS (C)
79.9 MB
LOGOS (JIT)
80.6 MB
LOGOS (VM)
93.8 MB
Go
145.0 MB
JavaScript
240.6 MB
LOGOS (C, bytecode)
258.9 MB
Java
525.5 MB
Binary size — compiled-artifact footprint
Shipped size of the compiled program — the stripped, code-only binary you actually deploy, so every language is compared on the same basis. Shorter bar ships less; the as-built size (with symbols) is in parentheses.
Java
2 KB (2 KB as-built)
C (gcc)
14 KB (16 KB as-built)
C++ (gcc)
14 KB (16 KB as-built)
C (clang)
14 KB (16 KB as-built)
C++ (clang)
14 KB (16 KB as-built)
Zig
25 KB (915 KB as-built)
Nim
30 KB (36 KB as-built)
Rust
300 KB (1.9 MB as-built)
LOGOS (Rust)
354 KB (2.1 MB as-built)
LOGOS (C)
551 KB (556 KB as-built)
LOGOS (C, bytecode)
563 KB (568 KB as-built)
Go
1.2 MB (1.8 MB as-built)
The size of the program you actually ship. C and C++ stay tiny because the runtime lives in the system libc; Rust and Go statically link their runtimes; LOGOS compiles to a compact self-contained binary in between. Java’s figure is its bytecode alone — it still needs the JVM to run — and JavaScript has no compiled artifact at all (its footprint is the V8 engine, in the Interpreter section). As-built is the real shipped file; stripped removes debug symbols for a code-only comparison.
LanguageMeanMedianStdDevMinMaxUserSystemCVRuns
C (clang)199.5ms200.7ms±3.6ms193.4ms204.9ms170.1ms29.3ms0.01810
LOGOS (Rust)209.9ms211.7ms±4.6ms201.0ms213.7ms181.7ms28.1ms0.02210
C++ (clang)212.2ms213.4ms±5.1ms203.5ms219.5ms183.7ms28.3ms0.02410
Rust230.1ms227.3ms±4.3ms226.6ms238.7ms203.5ms26.3ms0.01910
C (gcc)228.9ms229.6ms±1.8ms225.4ms231.2ms200.3ms28.4ms0.00810
C++ (gcc)247.0ms248.1ms±3.7ms240.9ms252.6ms217.6ms29.1ms0.01510
Nim261.6ms260.9ms±5.8ms255.0ms271.3ms242.0ms19.4ms0.02210
Zig263.3ms263.4ms±1.4ms259.6ms264.6ms219.1ms44.0ms0.00510
Go301.9ms302.2ms±2.8ms297.9ms306.2ms276.5ms40.1ms0.00910
Java378.9ms378.0ms±3.1ms375.5ms385.1ms296.2ms126.2ms0.00810
LOGOS (C)441.5ms440.4ms±3.9ms436.3ms448.0ms415.1ms26.1ms0.00910
JavaScript493.0ms493.2ms±8.6ms478.8ms503.4ms419.6ms84.7ms0.01710
LOGOS (C, bytecode)797.3ms795.7ms±4.9ms792.9ms807.0ms607.1ms187.3ms0.00610
LOGOS (JIT)815.0ms813.8ms±6.3ms807.7ms826.4ms792.2ms22.6ms0.00810
LOGOS (VM)10.98s10.98s±12.4ms10.96s11.00s10.95s25.4ms0.00110
LOGOS (tree-walker)>5min>5min———————
LOGOS vs JavaScript / V8
The LOGOS engine ladder — bytecode VM, copy-and-patch JIT, and the warm AOT-native tier — against Node v22.22.3 / V8.
5.8x
faster cold start than V8
2.0ms
LOGOS interpreter cold start
0.75x
the speed of V8 on compute (geomean)
Cold start — launch the engine and run a trivial program (50 runs, shorter is faster)
LOGOS interp
2.0ms
Node / V8
11.5ms
A native binary has no VM to warm up, so the LOGOS interpreter reaches first output in 2.0ms versus V8’s 12ms, about 5.8x quicker, which is what matters for short-lived work like cloud functions, CLI tools, and scripts. On long-running loops V8’s optimizing JIT pulls ahead: the interpreter is competitive on memory-bound work and behind on heavy compute, a geometric mean of 0.75x the speed of V8 across 27 benchmarks.
Engine size — the runtime you ship to execute a program (shorter ships less; stripped, code-only size in parentheses)
largo (LOGOS VM+JIT)
72.3 MB (58.8 MB stripped)
Node / V8
119.0 MB (102.1 MB stripped)
Node’s binary bundles V8, libuv, and ICU; largo bundles the transpiler, bytecode VM, and copy-and-patch JIT — each is the whole engine you ship to run a program. As-built is the real file; stripped removes debug symbols.
Merge Sort (engine: vm+jit)
Wall-clock time at n = 1441387 — shorter is faster. The interpreter runs at 0.60x the speed of V8 here.
Node / V8
239.6ms
LOGOS (eager)
401.5ms
LOGOS (tiered)
402.5ms
Source Code
The LOGOS source and the Rust it compiles to. Switch an optimization off and watch its “## No <X>” decorator appear on the LOGOS source — and the generated Rust recompile live in your browser. With every optimization on you see the cached release build; disabling them all yields plain, boring Rust.
analyzing which optimizations this program uses…
Trace for LOGOS (Rust)
optimizer producednone
backend loweredpeephole, borrow, unbox, hoistborrows, oraclehints, unchecked, strengthreducepow2, masknarrow, hintversion
LOGOS
## To native args () -> Seq of Text ## To native parseInt (s: Text) -> Int ## To mergeSort (arr: Seq of Int) -> Seq of Int: Let n be length of arr. If n is less than 2: Return arr. Let mid be n / 2. Let mutable left be a new Seq of Int. Let mutable right be a new Seq of Int. Let mutable i be 1. While i is at most mid: Push item i of arr to left. Set i to i + 1. While i is at most n: Push item i of arr to right. Set i to i + 1. Set left to mergeSort(left). Set right to mergeSort(right). Let mutable result be arr. Let mutable li be 1. Let mutable ri be 1. Let mutable k be 1. While li is at most length of left and ri is at most length of right: If item li of left is at most item ri of right: Set item k of result to item li of left. Set li to li + 1. Otherwise: Set item k of result to item ri of right. Set ri to ri + 1. Set k to k + 1. While li is at most length of left: Set item k of result to item li of left. Set li to li + 1. Set k to k + 1. While ri is at most length of right: Set item k of result to item ri of right. Set ri to ri + 1. Set k to k + 1. Return result. ## Main Let arguments be args(). Let n be parseInt(item 2 of arguments). Let mutable arr be a new Seq of Int. Let mutable seed be 42. Let mutable i be 0. While i is less than n: Set seed to (seed * 1103515245 + 12345) % 2147483648. Push (seed / 65536) % 32768 to arr. Set i to i + 1. Set arr to mergeSort(arr). Let mutable checksum be 0. Set i to 1. While i is at most n: Set checksum to (checksum * 31 + item i of arr) & 268435455. Set i to i + 1. Show "" + item 1 of arr + " " + item n of arr + " " + checksum.
The Rust largo build --release hands to cargo, every optimization on.
#[allow(unused_imports)] use std::fmt::Write as _; use logicaffeine_data::*; use logicaffeine_system::*; fn args() -> LogosSeq<String> { logicaffeine_system::env::args() } fn parseInt(s: String) -> i64 { (logicaffeine_system::text::parseInt(s)) as i64 } fn mergeSort(arr: &mut [i64]) { let n = (arr.len() as i64); if (n < 2) { return; } let mid = (n >> 1); let mut right: Vec<i64> = Vec::new(); let mut left: Vec<i64> = arr.logos_run_through(1, mid).to_vec(); let mut i: i64 = std::cmp::max(1, mid + 1); right.extend_from_slice(arr.logos_run_through(i, n)); mergeSort(&mut left); mergeSort(&mut right); let mut result = arr; let mut li: i64 = 1; let mut ri: i64 = 1; let mut k: i64 = 1; let left_len = (left.len() as i64); let right_len = (right.len() as i64); while ((li <= left_len) && (ri <= right_len)) { debug_assert!(((li - 1)) >= 0 && ((li - 1)) < (left.len() as i64), "LOGOS oracle bounds hint violated: indexing `left` out of range"); unsafe { std::hint::assert_unchecked(((li - 1)) >= 0 && ((li - 1)) < (left.len() as i64)); } debug_assert!(((ri - 1)) >= 0 && ((ri - 1)) < (right.len() as i64), "LOGOS oracle bounds hint violated: indexing `right` out of range"); unsafe { std::hint::assert_unchecked(((ri - 1)) >= 0 && ((ri - 1)) < (right.len() as i64)); } if (unsafe { *left.get_unchecked((li - 1) as usize) } <= unsafe { *right.get_unchecked((ri - 1) as usize) }) { debug_assert!(((k - 1)) >= 0 && ((k - 1)) < (result.len() as i64), "LOGOS oracle bounds hint violated: indexing `result` out of range"); unsafe { std::hint::assert_unchecked(((k - 1)) >= 0 && ((k - 1)) < (result.len() as i64)); } debug_assert!(((li - 1)) >= 0 && ((li - 1)) < (left.len() as i64), "LOGOS oracle bounds hint violated: indexing `left` out of range"); unsafe { std::hint::assert_unchecked(((li - 1)) >= 0 && ((li - 1)) < (left.len() as i64)); } debug_assert!(((k - 1)) >= 0 && ((k - 1)) < (result.len() as i64), "LOGOS oracle BCE: store out of range"); let __set_val = unsafe { *left.get_unchecked((li - 1) as usize) }; unsafe { *result.get_unchecked_mut((k - 1) as usize) = __set_val; } li = logos_add_i64(li, 1); } else { debug_assert!(((k - 1)) >= 0 && ((k - 1)) < (result.len() as i64), "LOGOS oracle bounds hint violated: indexing `result` out of range"); unsafe { std::hint::assert_unchecked(((k - 1)) >= 0 && ((k - 1)) < (result.len() as i64)); } debug_assert!(((ri - 1)) >= 0 && ((ri - 1)) < (right.len() as i64), "LOGOS oracle bounds hint violated: indexing `right` out of range"); unsafe { std::hint::assert_unchecked(((ri - 1)) >= 0 && ((ri - 1)) < (right.len() as i64)); } debug_assert!(((k - 1)) >= 0 && ((k - 1)) < (result.len() as i64), "LOGOS oracle BCE: store out of range"); let __set_val = unsafe { *right.get_unchecked((ri - 1) as usize) }; unsafe { *result.get_unchecked_mut((k - 1) as usize) = __set_val; } ri = logos_add_i64(ri, 1); } k = logos_add_i64(k, 1); } let left_len = (left.len() as i64); while (li <= left_len) { debug_assert!(((li - 1)) >= 0 && ((li - 1)) < (left.len() as i64), "LOGOS oracle bounds hint violated: indexing `left` out of range"); unsafe { std::hint::assert_unchecked(((li - 1)) >= 0 && ((li - 1)) < (left.len() as i64)); } *result.logos_item_front_mut(k) = unsafe { *left.get_unchecked((li - 1) as usize) }; li = logos_add_i64(li, 1); k = logos_add_i64(k, 1); } let right_len = (right.len() as i64); while (ri <= right_len) { debug_assert!(((ri - 1)) >= 0 && ((ri - 1)) < (right.len() as i64), "LOGOS oracle bounds hint violated: indexing `right` out of range"); unsafe { std::hint::assert_unchecked(((ri - 1)) >= 0 && ((ri - 1)) < (right.len() as i64)); } *result.logos_item_front_mut(k) = unsafe { *right.get_unchecked((ri - 1) as usize) }; ri = logos_add_i64(ri, 1); k = logos_add_i64(k, 1); } return; } fn main() { std::panic::set_hook(::std::boxed::Box::new(|_logos_info| { logicaffeine_system::io::flush_stdout(); let _logos_msg = _logos_info.payload().downcast_ref::<&str>().map(|s| s.to_string()) .or_else(|| _logos_info.payload().downcast_ref::<String>().cloned()) .unwrap_or_else(|| "LOGOS runtime error".to_string()); eprintln!("{}", _logos_msg); if !logicaffeine_system::failure::is_caught() { std::process::exit(1); } })); logicaffeine_system::stack::run_main(_logos_main); } fn _logos_main() { let arguments = args(); let n = logicaffeine_system::text::parseInt((arguments.borrow().logos_item_front(2).clone()).to_string()); let mut arr: Vec<i64> = Vec::with_capacity((n as usize) as usize); let mut seed: i64 = 42; { let mut arr = &mut arr; for i in 0..n { seed = (((((seed) as u32).wrapping_mul(1103515245u32).wrapping_add(12345u32)) & 2147483647u32) as i64); arr.push(((seed >> 16) & 32767)); } } let mut i: i64 = (0_i64).max(n); mergeSort(&mut arr); let mut checksum: i64 = 0; let __arr_bhl = arr.len() as i64; let __arr_bh_ok = n <= __arr_bhl; { let arr = &arr[..]; if __arr_bh_ok { for i in 0..n { unsafe { std::hint::assert_unchecked(n <= __arr_bhl); } checksum = { let __bwl1: i64 = (*arr.logos_item_front((i + 1))); match (|| -> Option<i64> { Some(checksum.checked_mul((31i64))?.checked_add(__bwl1)?) })() { Some(__bwlv) => (__bwlv & 268435455i64), _ => logos_cold_path(move || logos_band_exact(logos_add_exact(logos_mul_exact(checksum, 31i64), __bwl1), 268435455i64)) } }; } } else { for i in 0..n { checksum = { let __bwl1: i64 = (*arr.logos_item_front((i + 1))); match (|| -> Option<i64> { Some(checksum.checked_mul((31i64))?.checked_add(__bwl1)?) })() { Some(__bwlv) => (__bwlv & 268435455i64), _ => logos_cold_path(move || logos_band_exact(logos_add_exact(logos_mul_exact(checksum, 31i64), __bwl1), 268435455i64)) } }; } } } show(&format!("{}{}{}{}{}{}", "", (*arr.logos_item_front(1)), " ", (*arr.logos_item(n)), " ", checksum)); }
Cgcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0View on GitHub →▶
#include <stdio.h> #include <stdlib.h> #include <string.h> void merge_sort(long *arr, long n) { if (n < 2) return; long mid = n / 2; long *left = malloc(mid * sizeof(long)); long *right = malloc((n - mid) * sizeof(long)); memcpy(left, arr, mid * sizeof(long)); memcpy(right, arr + mid, (n - mid) * sizeof(long)); merge_sort(left, mid); merge_sort(right, n - mid); long i = 0, j = 0, k = 0; while (i < mid && j < n - mid) { if (left[i] <= right[j]) arr[k++] = left[i++]; else arr[k++] = right[j++]; } while (i < mid) arr[k++] = left[i++]; while (j < n - mid) arr[k++] = right[j++]; free(left); free(right); } int main(int argc, char *argv[]) { if (argc < 2) return 1; long n = atol(argv[1]); long *arr = malloc(n * sizeof(long)); long seed = 42; for (long i = 0; i < n; i++) { seed = (seed * 1103515245 + 12345) % 2147483648L; arr[i] = (seed >> 16) & 0x7fff; } merge_sort(arr, n); long checksum = 0; for (long i = 0; i < n; i++) checksum = (checksum * 31 + arr[i]) & 268435455; printf("%ld %ld %ld\n", arr[0], arr[n-1], checksum); free(arr); return 0; }
C++g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0View on GitHub →▶
#include <cstdio> #include <cstdlib> #include <cstring> void merge_sort(long *arr, long n) { if (n < 2) return; long mid = n / 2; long *left = new long[mid]; long *right = new long[n - mid]; std::memcpy(left, arr, mid * sizeof(long)); std::memcpy(right, arr + mid, (n - mid) * sizeof(long)); merge_sort(left, mid); merge_sort(right, n - mid); long i = 0, j = 0, k = 0; while (i < mid && j < n - mid) { if (left[i] <= right[j]) arr[k++] = left[i++]; else arr[k++] = right[j++]; } while (i < mid) arr[k++] = left[i++]; while (j < n - mid) arr[k++] = right[j++]; delete[] left; delete[] right; } int main(int argc, char *argv[]) { if (argc < 2) return 1; long n = atol(argv[1]); long *arr = new long[n]; long seed = 42; for (long i = 0; i < n; i++) { seed = (seed * 1103515245 + 12345) % 2147483648L; arr[i] = (seed >> 16) & 0x7fff; } merge_sort(arr, n); long checksum = 0; for (long i = 0; i < n; i++) checksum = (checksum * 31 + arr[i]) & 268435455; printf("%ld %ld %ld\n", arr[0], arr[n-1], checksum); delete[] arr; return 0; }
Rustrustc 1.96.0 (ac68faa20 2026-05-25)View on GitHub →▶
use std::env; fn merge_sort(arr: &mut Vec<i64>) { let n = arr.len(); if n < 2 { return; } let mid = n / 2; let mut left = arr[..mid].to_vec(); let mut right = arr[mid..].to_vec(); merge_sort(&mut left); merge_sort(&mut right); let (mut i, mut j, mut k) = (0, 0, 0); while i < left.len() && j < right.len() { if left[i] <= right[j] { arr[k] = left[i]; i += 1; } else { arr[k] = right[j]; j += 1; } k += 1; } while i < left.len() { arr[k] = left[i]; i += 1; k += 1; } while j < right.len() { arr[k] = right[j]; j += 1; k += 1; } } fn main() { let n: usize = env::args().nth(1).unwrap().parse().unwrap(); let mut arr = Vec::with_capacity(n); let mut seed: i64 = 42; for _ in 0..n { seed = (seed.wrapping_mul(1103515245) + 12345) % 2147483648; arr.push((seed >> 16) & 0x7fff); } merge_sort(&mut arr); let mut checksum: i64 = 0; for &v in &arr { checksum = (checksum * 31 + v) & 268435455; } println!("{} {} {}", arr[0], arr[n - 1], checksum); }
Zig0.15.2View on GitHub →▶
const std = @import("std"); fn mergeSort(arr: []i64, allocator: std.mem.Allocator) std.mem.Allocator.Error!void { if (arr.len < 2) return; const mid = arr.len / 2; const left = try allocator.alloc(i64, mid); defer allocator.free(left); const right = try allocator.alloc(i64, arr.len - mid); defer allocator.free(right); @memcpy(left, arr[0..mid]); @memcpy(right, arr[mid..]); try mergeSort(left, allocator); try mergeSort(right, allocator); var i: usize = 0; var j: usize = 0; var k: usize = 0; while (i < mid and j < arr.len - mid) { if (left[i] <= right[j]) { arr[k] = left[i]; i += 1; } else { arr[k] = right[j]; j += 1; } k += 1; } while (i < mid) { arr[k] = left[i]; i += 1; k += 1; } while (j < arr.len - mid) { arr[k] = right[j]; j += 1; k += 1; } } pub fn main() !void { var buf: [4096]u8 = undefined; var stdout = std.fs.File.stdout().writer(&buf); var args = std.process.args(); _ = args.skip(); const n_str = args.next() orelse return; const n: usize = @intCast(try std.fmt.parseInt(i64, n_str, 10)); const allocator = std.heap.smp_allocator; var arr = try allocator.alloc(i64, n); defer allocator.free(arr); var seed: i64 = 42; for (0..n) |i| { seed = @rem(seed *% 1103515245 + 12345, 2147483648); arr[i] = (seed >> 16) & 0x7fff; } try mergeSort(arr, allocator); var checksum: i64 = 0; for (arr) |v| checksum = (checksum * 31 + v) & 268435455; try stdout.interface.print("{} {} {}\n", .{ arr[0], arr[n - 1], checksum }); try stdout.interface.flush(); }
Gogo version go1.22.2 linux/amd64View on GitHub →▶
package main import ( "fmt" "os" "strconv" ) func mergeSort(arr []int64) { n := len(arr) if n < 2 { return } mid := n / 2 left := make([]int64, mid) right := make([]int64, n-mid) copy(left, arr[:mid]) copy(right, arr[mid:]) mergeSort(left) mergeSort(right) i, j, k := 0, 0, 0 for i < mid && j < n-mid { if left[i] <= right[j] { arr[k] = left[i]; i++ } else { arr[k] = right[j]; j++ } k++ } for i < mid { arr[k] = left[i]; i++; k++ } for j < n-mid { arr[k] = right[j]; j++; k++ } } func main() { n, _ := strconv.Atoi(os.Args[1]) arr := make([]int64, n) seed := int64(42) for i := 0; i < n; i++ { seed = (seed*1103515245 + 12345) % 2147483648 arr[i] = (seed >> 16) & 0x7fff } mergeSort(arr) checksum := int64(0) for _, v := range arr { checksum = (checksum*31 + v) & 268435455 } fmt.Printf("%d %d %d\n", arr[0], arr[n-1], checksum) }
Javaopenjdk 21.0.12.1 2026-08-18View on GitHub →▶
import java.util.Arrays; public class Main { static void mergeSort(long[] arr) { int n = arr.length; if (n < 2) return; int mid = n / 2; long[] left = Arrays.copyOfRange(arr, 0, mid); long[] right = Arrays.copyOfRange(arr, mid, n); mergeSort(left); mergeSort(right); int i = 0, j = 0, k = 0; while (i < mid && j < n - mid) { if (left[i] <= right[j]) arr[k++] = left[i++]; else arr[k++] = right[j++]; } while (i < mid) arr[k++] = left[i++]; while (j < n - mid) arr[k++] = right[j++]; } public static void main(String[] args) { int n = Integer.parseInt(args[0]); long[] arr = new long[n]; long seed = 42; for (int i = 0; i < n; i++) { seed = (seed * 1103515245 + 12345) % 2147483648L; arr[i] = (seed >> 16) & 0x7fff; } mergeSort(arr); long checksum = 0; for (long v : arr) checksum = (checksum * 31 + v) & 268435455; System.out.println(arr[0] + " " + arr[n - 1] + " " + checksum); } }
JavaScriptv22.22.3View on GitHub →▶
function mergeSort(arr) { const n = arr.length; if (n < 2) return; const mid = Math.floor(n / 2); const left = arr.slice(0, mid); const right = arr.slice(mid); mergeSort(left); mergeSort(right); let i = 0, j = 0, k = 0; while (i < mid && j < n - mid) { if (left[i] <= right[j]) arr[k++] = left[i++]; else arr[k++] = right[j++]; } while (i < mid) arr[k++] = left[i++]; while (j < n - mid) arr[k++] = right[j++]; } const n = parseInt(process.argv[2]); const arr = []; let seed = 42; for (let i = 0; i < n; i++) { seed = ((Math.imul(seed, 1103515245) + 12345) >>> 0) % 2147483648; arr.push((seed >> 16) & 0x7fff); } mergeSort(arr); let checksum = 0; for (const v of arr) checksum = (checksum * 31 + v) & 268435455; console.log(`${arr[0]} ${arr[n - 1]} ${checksum}`);
import sys sys.setrecursionlimit(1000000) def merge_sort(arr): n = len(arr) if n < 2: return mid = n // 2 left = arr[:mid] right = arr[mid:] merge_sort(left) merge_sort(right) i = j = k = 0 while i < mid and j < n - mid: if left[i] <= right[j]: arr[k] = left[i]; i += 1 else: arr[k] = right[j]; j += 1 k += 1 while i < mid: arr[k] = left[i]; i += 1; k += 1 while j < n - mid: arr[k] = right[j]; j += 1; k += 1 def main(): n = int(sys.argv[1]) arr = [] seed = 42 for _ in range(n): seed = (seed * 1103515245 + 12345) % 2147483648 arr.append((seed >> 16) & 0x7fff) merge_sort(arr) checksum = 0 for v in arr: checksum = (checksum * 31 + v) & 268435455 print(f"{arr[0]} {arr[-1]} {checksum}") if __name__ == "__main__": main()
def merge_sort(arr) n = arr.length return if n < 2 mid = n / 2 left = arr[0...mid] right = arr[mid..] merge_sort(left) merge_sort(right) i = j = k = 0 while i < mid && j < n - mid if left[i] <= right[j]; arr[k] = left[i]; i += 1 else arr[k] = right[j]; j += 1; end k += 1 end while i < mid; arr[k] = left[i]; i += 1; k += 1; end while j < n - mid; arr[k] = right[j]; j += 1; k += 1; end end n = ARGV[0].to_i arr = [] seed = 42 n.times { seed = (seed * 1103515245 + 12345) % 2147483648; arr << ((seed >> 16) & 0x7fff) } merge_sort(arr) checksum = 0 arr.each { |v| checksum = (checksum * 31 + v) & 268435455 } puts "#{arr[0]} #{arr[-1]} #{checksum}"
NimNim Compiler Version 2.0.4 [Linux: amd64]View on GitHub →▶
import os, strutils proc mergeSort(arr: var seq[int64]) = let n = arr.len if n < 2: return let mid = n div 2 var left = arr[0..<mid] var right = arr[mid..<n] mergeSort(left) mergeSort(right) var i, j, k: int = 0 while i < left.len and j < right.len: if left[i] <= right[j]: arr[k] = left[i]; i += 1 else: arr[k] = right[j]; j += 1 k += 1 while i < left.len: arr[k] = left[i]; i += 1; k += 1 while j < right.len: arr[k] = right[j]; j += 1; k += 1 proc main() = let n = parseInt(paramStr(1)) var arr = newSeq[int64](n) var seed: int64 = 42 for i in 0..<n: seed = (seed * 1103515245 + 12345) mod 2147483648 arr[i] = (seed shr 16) and 0x7fff mergeSort(arr) var checksum: int64 = 0 for v in arr: checksum = (checksum * 31 + v) and 268435455 echo arr[0], " ", arr[^1], " ", checksum main()
Compilation Times
Time to compile each benchmark from source, with the same flags the timed builds use. LOGOS compiles through Rust or through C, so its bars include rustc or the C compiler at full optimization.
go build (GOAMD64 at the host level)
27.9ms
gcc -O3 -march=native -flto -ffp-contract=off
45.8ms
clang -O3 -march=native -flto -ffp-contract=off
59.4ms
g++ -O3 -march=native -flto -ffp-contract=off -std=c++17
69.8ms
clang++ -O3 -march=native -flto -ffp-contract=off -std=c++17
77.6ms
javac
204.2ms
zig build-exe -O ReleaseFast -mcpu native
260.4ms
largo build --release --emit c
393.2ms
nim c -d:danger --passC:"-O3 -march=native -flto -ffp-contract=off" --passL:"-O3 -march=native -flto"
521.6ms
largo build --release --emit c-bytecode
553.9ms
rustc --edition 2021 -C opt-level=3 -C lto=fat -C codegen-units=1 -C target-cpu=native -C panic=abort
1.40s
largo build
1.57s
largo build --release
17.73s
CompilerMeanStdDev
go build (GOAMD64 at the host level)27.9ms±2.3ms
gcc -O3 -march=native -flto -ffp-contract=off45.8ms±885µs
clang -O3 -march=native -flto -ffp-contract=off59.4ms±1.0ms
g++ -O3 -march=native -flto -ffp-contract=off -std=c++1769.8ms±1.3ms
clang++ -O3 -march=native -flto -ffp-contract=off -std=c++1777.6ms±1.4ms
javac204.2ms±5.1ms
zig build-exe -O ReleaseFast -mcpu native260.4ms±1.9ms
largo build --release --emit c393.2ms±1.9ms
nim c -d:danger --passC:"-O3 -march=native -flto -ffp-contract=off" --passL:"-O3 -march=native -flto"521.6ms±2.3ms
largo build --release --emit c-bytecode553.9ms±3.3ms
rustc --edition 2021 -C opt-level=3 -C lto=fat -C codegen-units=1 -C target-cpu=native -C panic=abort1.40s±13.2ms
largo build1.57s±11.3ms
largo build --release17.73s±23.1ms
Cross-Benchmark Summary
Geometric-mean speed vs C across all 35 benchmarks (bars proportional to speed; higher is faster).
LOGOS
LOGOS (Rust)
4.16×
LOGOS (C)
2.08×
LOGOS (C, bytecode)
1.18×
LOGOS (JIT)
0.62×
LOGOS (VM)
0.03×
LOGOS (tree-walker)
0.01×
Systems
C (clang)
1.13×
C++ (clang)
1.13×
Zig
1.09×
Rust
1.05×
C (gcc)
1.00×
C++ (gcc)
0.99×
Managed
Go
0.83×
Java
0.72×
JavaScript
0.52×
Transpiled
Nim
1.10×
  • Each benchmark measured with hyperfine (10 runs, 2 warmup), pinned to the performance cores on a machine checked quiet first; the bars show the median, and every ratio and geometric mean uses the mean.
  • CPU: Intel(R) Core(TM) i9-14900K.
  • OS: Ubuntu 24.04.2 LTS x86_64.
  • Every implementation runs the same algorithm, with its sorts and hash tables hand-rolled in every language, and produces identical output, verified byte for byte before anything is timed.
  • Every compiled language is built at its fastest release setting for this CPU, with the commands below; C, C++ and Nim compile with floating-point contraction off, as every other language rounds each operation.
  • With the algorithm unchanged, the LOGOS compiler also chooses storage the other programs spell out: an Int it proves fits in 32 bits is stored in 32 bits, a local Seq of Bool is held one bit per item, and the remainder of a value proven below twice its divisor is one subtraction. These count as the same algorithm.
  • Two geometric means are reported vs C: the headline keeps all 35 benchmarks; the apples-to-apples figure removes the 8 where the LOGOS compiler collapses the algorithm (⚡). Every collapse is auditable in the generated Rust per benchmark.
  • The Interpreter-vs-V8 section is a separate peer comparison (LOGOS bytecode VM + JIT against Node/V8) at interpreter-calibrated sizes, so its n differs from the compiled section.

Compiler Versions

LanguageVersion
Rustrustc 1.96.0 (ac68faa20 2026-05-25)
OtherUbuntu clang version 21.1.8 (++20251221032922+2078da43e25a-1~exp1~20251221153059.70)
C++g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
LOGOSlargo 0.11.0
JavaScriptv22.22.3
Otherlargo 0.11.0
Javaopenjdk 21.0.12.1 2026-08-18
Otherlargo 0.11.0
Gogo version go1.22.2 linux/amd64
Zig0.15.2
Cgcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
NimNim Compiler Version 2.0.4 [Linux: amd64]
OtherUbuntu clang version 21.1.8 (++20251221032922+2078da43e25a-1~exp1~20251221153059.70)
Otherlargo 0.11.0
Otherlargo 0.11.0
Otherlargo 0.11.0
Otherhyperfine 1.18.0

Build commands

LanguageBuilt and run with
C (gcc)gcc -O3 -march=native -flto -ffp-contract=off -o bench main.c -lm
C (clang)clang -O3 -march=native -flto -ffp-contract=off -o bench main.c -lm
C++ (gcc)g++ -O3 -march=native -flto -ffp-contract=off -std=c++17 -o bench main.cpp
C++ (clang)clang++ -O3 -march=native -flto -ffp-contract=off -std=c++17 -o bench main.cpp
Rustrustc --edition 2021 -C opt-level=3 -C lto=fat -C codegen-units=1 -C target-cpu=native -C panic=abort -o bench main.rs
Zigzig build-exe -O ReleaseFast -mcpu native -femit-bin=bench main.zig
GoGOAMD64=v3 go build -o bench main.go
Javajavac -d classes Main.java
JavaScriptnode --stack-size=4000 main.js
Nimnim c -d:danger --passC:"-O3 -march=native -flto -ffp-contract=off" --passL:"-O3 -march=native -flto" --hints:off -o:bench main.nim
LOGOS (Rust)largo build --release
LOGOS (C)largo build --release --emit c
LOGOS (C, bytecode)largo build --release --emit c-bytecode
LOGOS (JIT)logos-jit-image-build; logos-jit-run
LOGOS (VM)largo run --interpret --engine vm
LOGOS (tree-walker)largo run --interpret --engine tree

Links