Navigation
Syntax Guide
Part I: Programming in LOGOS
1. Introduction2. Getting Started3. Variables and Types4. Operators and Expressions5. Control Flow6. Functions7. Collections8. User-Defined Types9. Generics10. Memory and Ownership11. The Zone System12. Concurrency13. Distributed Types (CRDTs)14. Policy-Based Security15. P2P Networking16. Error Handling17. Advanced FeaturesPart III: Logic Mode
21. Logic ModeLearn Logic
Benchmarks
LOGOS compiles to Rust. Rust-level performance, English-level readability.
LOGOS compiled vs C
2.62x*
the speed of C (geomean)
Same algorithm as C
1.27x
the speed of C (geomean)
Interpreted LOGOS vs V8
1.04x
the speed of V8 (geomean)
The headline covers all 32 benchmarks. On 5 of them the LOGOS compiler reduces the work itself, for example by folding a recursive function into a closed form, so it runs a faster algorithm than the C version rather than just faster machine code. Those wins are real, and the generated Rust for each is shown in the Source Code section below. The second number is the geometric mean over the remaining 27 benchmarks, where LOGOS and C compile the same algorithm. Both numbers are “x the speed of C”, so higher is faster.
Recursive Fibonacci
Naive recursive Fibonacci. (n = 40)
This one collapsed. The LOGOS optimizer folds the naive recursion to a closed form, so it does far less work than the runtime recursion the other languages execute — a compiler transform, not like-for-like codegen. See the generated Rust below.
Wall-clock time at n = 40 — shorter bar is faster.
Systems
Managed
Transpiled
Scaling — time vs problem size (log–log)
C
C++
Rust
Zig
LOGOS
Go
Java
JavaScript
Nim
Complexity
time O(2^n)space O(n)
Measured time growth
Ct ≈ n^13.20
C++t ≈ n^13.21
Rustt ≈ n^14.53
Zigt ≈ n^14.65
LOGOSt ≈ n^-0.11
Got ≈ n^14.59
Javat ≈ n^8.79
JavaScriptt ≈ n^11.26
Nimt ≈ n^15.15
Measured space growth
Crss ≈ n^-0.65
C++rss ≈ n^-0.65
Rustrss ≈ n^0.00
Zigrss ≈ n^0.00
LOGOSrss ≈ n^0.00
Gorss ≈ n^-0.03
Javarss ≈ n^0.04
JavaScriptrss ≈ n^0.02
Nimrss ≈ n^0.00
Memory — peak resident set size
Peak resident memory at n = 40 — shorter bar uses less.
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.
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.
| Language | Mean | Median | StdDev | Min | Max | User | System | CV | Runs |
|---|---|---|---|---|---|---|---|---|---|
| LOGOS | 448µs | 442µs | ±34µs | 414µs | 539µs | 307µs | 190µs | 0.076 | 10 |
| C | 94.8ms | 93.4ms | ±6.0ms | 90.5ms | 109.4ms | 94.0ms | 600µs | 0.063 | 10 |
| C++ | 94.2ms | 94.0ms | ±2.5ms | 91.7ms | 100.3ms | 93.1ms | 857µs | 0.026 | 10 |
| Rust | 163.1ms | 163.3ms | ±7.1ms | 152.9ms | 175.9ms | 162.6ms | 368µs | 0.043 | 10 |
| Zig | 165.5ms | 168.7ms | ±6.5ms | 155.0ms | 172.6ms | 164.9ms | 370µs | 0.039 | 10 |
| Nim | 231.8ms | 232.1ms | ±4.1ms | 226.9ms | 238.6ms | 231.0ms | 578µs | 0.018 | 10 |
| Java | 268.4ms | 268.3ms | ±3.9ms | 262.5ms | 272.8ms | 260.3ms | 12.3ms | 0.014 | 10 |
| Go | 281.1ms | 282.5ms | ±4.0ms | 272.5ms | 285.7ms | 280.9ms | 1.6ms | 0.014 | 10 |
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.
6.0x
faster cold start than V8
2.3ms
LOGOS interpreter cold start
1.04x
the speed of V8 on compute (geomean)
Cold start — launch the engine and run a trivial program (50 runs, shorter is faster)
A native binary has no VM to warm up, so the LOGOS interpreter reaches first output in 2.3ms versus V8’s 14ms, about 6.0x 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 1.04x the speed of V8 across 30 benchmarks.
Engine size — the runtime you ship to execute a program (shorter ships less; stripped, code-only size in parentheses)
In the browser the whole LOGOS engine ships as a 11.6 MB WebAssembly bundle — the same VM+JIT, no native install. 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.
Recursive Fibonacci (engine: vm+jit)
Wall-clock time at n = 38 — shorter is faster. The interpreter runs at 1.11x the speed of V8 here.
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…
LOGOS
## To native args () -> Seq of Text
## To native parseInt (s: Text) -> Int
## To fib (n: Int) -> Int:
If n is less than 2:
Return n.
Return fib(n - 1) + fib(n - 2).
## Main
Let arguments be args().
Let n be parseInt(item 2 of arguments).
Show fib(n).
Generated Rust
#[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)
}
fn fib(n: i64) -> i64 {
use std::cell::RefCell;
thread_local! {
static __MEMO_FIB: RefCell<FxHashMap<i64, i64>> = RefCell::new(FxHashMap::default());
}
if let Some(__v) = __MEMO_FIB.with(|c| c.borrow().get(&n).copied()) {
return __v;
}
let __memo_result = (|| -> i64 {
if (n < 2) {
return n;
}
return (fib(logos_sub_i64(n, 1)) + fib(logos_sub_i64(n, 2)));
})();
__MEMO_FIB.with(|c| c.borrow_mut().insert(n, __memo_result));
__memo_result
}
fn main() {
std::thread::Builder::new()
.stack_size(67_108_864)
.spawn(_logos_main)
.unwrap().join().unwrap();
}
fn _logos_main() {
let arguments = args();
let n = parseInt(arguments.borrow()[1].clone());
show(&fib(n));
}
#include <stdio.h>
#include <stdlib.h>
long fib(long n) {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
int main(int argc, char *argv[]) {
if (argc < 2) { fprintf(stderr, "Usage: fib <n>\n"); return 1; }
long n = atol(argv[1]);
printf("%ld\n", fib(n));
return 0;
}
#include <cstdio>
#include <cstdlib>
long fib(long n) {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
int main(int argc, char *argv[]) {
if (argc < 2) { fprintf(stderr, "Usage: fib <n>\n"); return 1; }
long n = std::atol(argv[1]);
printf("%ld\n", fib(n));
return 0;
}
fn fib(n: i64) -> i64 {
if n < 2 { return n; }
fib(n - 1) + fib(n - 2)
}
fn main() {
let n: i64 = std::env::args().nth(1).unwrap().parse().unwrap();
println!("{}", fib(n));
}
const std = @import("std");
fn fib(n: i64) i64 {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
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 arg = args.next() orelse return;
const n = try std.fmt.parseInt(i64, arg, 10);
try stdout.interface.print("{}\n", .{fib(n)});
try stdout.interface.flush();
}
package main
import (
"fmt"
"os"
"strconv"
)
func fib(n int64) int64 {
if n < 2 {
return n
}
return fib(n-1) + fib(n-2)
}
func main() {
n, _ := strconv.ParseInt(os.Args[1], 10, 64)
fmt.Println(fib(n))
}
public class Main {
static long fib(long n) {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
public static void main(String[] args) {
long n = Long.parseLong(args[0]);
System.out.println(fib(n));
}
}
function fib(n) {
if (n < 2) return n;
return fib(n - 1) + fib(n - 2);
}
const n = parseInt(process.argv[2]);
console.log(fib(n));
import sys
def fib(n):
if n < 2:
return n
return fib(n - 1) + fib(n - 2)
n = int(sys.argv[1])
print(fib(n))
def fib(n)
return n if n < 2
fib(n - 1) + fib(n - 2)
end
n = ARGV[0].to_i
puts fib(n)
import os, strutils
proc fib(n: int64): int64 =
if n < 2: return n
return fib(n - 1) + fib(n - 2)
let n = parseInt(paramStr(1)).int64
echo fib(n)
Compilation Times
Time to compile each benchmark from source, at the same flags used for the runtime numbers. LOGOS compiles English to Rust, then invokes rustc at full optimization (-O3, fat LTO, target-cpu=native) — so its bar includes the Rust compile.
| Compiler | Mean | StdDev |
|---|---|---|
| gcc -O3 -march=native -flto | 64.3ms | ±661µs |
| g++ -O3 -march=native -flto | 73.1ms | ±5.5ms |
| go build (release) | 76.0ms | ±3.7ms |
| javac | 177.2ms | ±6.4ms |
| zig build-exe -O ReleaseFast -mcpu native | 201.9ms | ±1.2ms |
| nim c -d:release -march=native | 293.3ms | ±4.5ms |
| rustc -O3 -C lto=fat -C target-cpu=native | 1.41s | ±7.2ms |
| largo build (debug) | 1.72s | ±27.5ms |
| largo build --release → rustc -O3 -C lto=fat -C codegen-units=1 -C target-cpu=native | 10.68s | ±32.7ms |
Cross-Benchmark Summary
Geometric-mean speed vs C across all 32 benchmarks (bars proportional to speed; higher is faster).
- Each benchmark measured with hyperfine (10 runs, 2 warmup); the bars show the median.
- CPU: Intel(R) Core(TM) i9-14900K.
- OS: Ubuntu 24.04.2 LTS x86_64.
- Every implementation runs the same algorithm and produces identical, verified output.
- All compiled languages are built at full, matched optimization (see flags below) — no language is handicapped relative to LOGOS.
- Two geometric means are reported vs C: the headline keeps all 32 benchmarks; the apples-to-apples figure removes the 5 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
| Language | Version |
|---|---|
| Other | v22.22.3 |
| Rust | rustc 1.96.0 (ac68faa20 2026-05-25) |
| Go | go version go1.22.2 linux/amd64 |
| Nim | Nim Compiler Version 2.0.4 [Linux: amd64] |
| Java | openjdk 21.0.11 2026-04-21 |
| C | gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 |
| C++ | g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 |
| Zig | 0.15.2 |
Compiler Flags
| Language | Flags |
|---|---|
| C | gcc -O3 -march=native -flto -lm |
| C++ | g++ -O3 -march=native -flto -std=c++17 |
| Rust | rustc --edition 2021 -C opt-level=3 -C lto=fat -C codegen-units=1 -C target-cpu=native |
| Zig | zig build-exe -O ReleaseFast -mcpu native |
| Go | go build (Go has no -O levels; this is its optimizing release build) |
| Java | javac, run on the HotSpot JIT |
| Nim | nim c -d:release --passC:"-O3 -march=native" |
| JavaScript | node (V8 JIT) |
| LOGOS | largo build --release → generated Rust → rustc -C opt-level=3 -C lto=fat -C codegen-units=1 -C target-cpu=native |
| LOGOS (interpreted) | largo run --interpret (bytecode VM + copy-and-patch JIT) |
Links
- benchmarks/run.sh — benchmark runner script
- results/latest.json — raw benchmark data
- results/history/ — historical results by version
- benchmarks/ — all benchmark source code