Benchmarks

Constructs

Raw Struct Race · Identity construct versus inline pair

A local Range construct whose unobservable identity is eliminated versus optimized inline 32-bit C, C++, Rust, Go, and Swift values

Raw Struct Race

Identity construct versus inline pair

40m constructions · 30 runs

A local Range construct whose unobservable identity is eliminated versus optimized inline 32-bit C, C++, Rust, Go, and Swift values

C 133.6 msabsolute best
Range 133.6 ms
C++ 133.8 ms
Rust 134.2 ms
Swift 134.7 ms
Go 156.4 ms
Test code
C · main.c
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct { int32_t x; int32_t y; } Pair;
int main(int argc, char **argv) {
    int32_t n = argc > 1 ? (int32_t)atoi(argv[1]) : 40000000;
    int32_t acc = 0;
    for (int32_t i = 0; i < n; i++) {
        Pair pair = (Pair){i, i + 1};
        acc = (acc + pair.x + pair.y) % 1000003;
    }
    printf("%" PRId32 "\n", acc);
}
Range · Playground.range
construct Pair {
    let x: Int
    let y: Int
}

@main {
    let n: Int(40000000)
    state i: Int(0)
    state acc: Int(0)
    while i < n {
        let pair: Pair(x: i, y: i + 1)
        acc: (acc + pair.x + pair.y) % 1000003
        i: i + 1
    }
    return acc % 251
}

Measurements

Range passed

LanguageWallCPUPeak memoryRelativeOutput
C133.6 ms131.3 ms1.6 MB1.00×14400
Range133.6 ms131.6 ms1.6 MB1.00×exit:93
C++133.8 ms131.6 ms1.6 MB1.00×14400
Rust134.2 ms131.9 ms1.8 MB1.00×14400
Swift134.7 ms132.2 ms2.0 MB1.01×14400
Go156.4 ms154.1 ms4.1 MB1.17×14400

Run procedure

01Generated sourceisolated case directory
02 · optimized builds
  • Ccc · O3
  • C++c++ · O3
  • Rustrustc · opt 3
  • Gogo build
  • Swiftswiftc · Ounchecked
  • RangeLLVM · clang O3
03Rotating run order30 measured runs
04Validate outputexit code + identical result
05Median resultswall · CPU · peak RSS
Commands and notes
Suite
N=<base-iterations> RUNS=<sample-count> npm run benchmarks
C
cc -O3 -mcpu=native main.c -o speed-c
./speed-c <iterations>
Range
RangeCompiler emit-llvm Playground.range Main.ll
clang -O3 -mcpu=native -Wno-override-module Main.ll <runtime-sources> -o speed-range
./speed-range
  • The workload count is specialized per leaf; some leaves intentionally scale it down to keep total work comparable.
  • Wall time includes process execution but excludes source generation and compilation.
  • A result is published only when output remains stable across every measured run.
  • Bun and TypeScript rows are omitted when their local toolchains are unavailable.