Benchmark suite

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.
Constructs4 comparisons

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
}

Identity

Eight-level nested chain

4m chains · 30 runs

Build and traverse an eight-level stable-identity chain; Range arena and legacy malloc use identical generated LLVM

Range 111.0 ms
C 273.9 ms
C++ 298.5 ms
Rust 309.5 ms
Range malloc 315.4 ms
Go 407.0 ms
Swift 446.7 ms
Test code
C · main.c
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct L0 { int64_t value; } L0;
typedef struct L1 { L0 *child; } L1;
typedef struct L2 { L1 *child; } L2;
typedef struct L3 { L2 *child; } L3;
typedef struct L4 { L3 *child; } L4;
typedef struct L5 { L4 *child; } L5;
typedef struct L6 { L5 *child; } L6;
typedef struct L7 { L6 *child; } L7;
static volatile uintptr_t identity_sink;
int main(int argc, char **argv) {
    int64_t n = argc > 1 ? atoll(argv[1]) : 4000000, checksum = 0;
    for (int64_t i = 0; i < n; ++i) {
        L0 *l0 = malloc(sizeof(*l0)); *l0 = (L0){i};
        L1 *l1 = malloc(sizeof(*l1)); *l1 = (L1){l0};
        L2 *l2 = malloc(sizeof(*l2)); *l2 = (L2){l1};
        L3 *l3 = malloc(sizeof(*l3)); *l3 = (L3){l2};
        L4 *l4 = malloc(sizeof(*l4)); *l4 = (L4){l3};
        L5 *l5 = malloc(sizeof(*l5)); *l5 = (L5){l4};
        L6 *l6 = malloc(sizeof(*l6)); *l6 = (L6){l5};
        L7 *l7 = malloc(sizeof(*l7)); *l7 = (L7){l6};
        identity_sink ^= (uintptr_t)l7;
        checksum = (checksum + l7->child->child->child->child->child->child->child->value) % 1000003;
    }
    printf("%" PRId64 "\n", checksum);
}
Range · Playground.range
construct L0 { let value: Int }
construct L1 { let child: L0 }
construct L2 { let child: L1 }
construct L3 { let child: L2 }
construct L4 { let child: L3 }
construct L5 { let child: L4 }
construct L6 { let child: L5 }
construct L7 { let child: L6 }
@main {
    state i: Int(0)
    state checksum: Int(0)
    while i < 4000000 {
        let root: L7(child: L6(child: L5(child: L4(child: L3(child: L2(child: L1(child: L0(value: i))))))))
        checksum: (checksum + root.child.child.child.child.child.child.child.value) % 1000003
        i: i + 1
    }
    return checksum % 251
}

Identity

Shared binding mutation

40m mutations · 30 runs

Mutate one array cell through a stable binding path and observe every update through its original owner path

C 123.0 msabsolute best
Rust 123.1 ms
C++ 123.8 ms
Go 124.3 ms
Swift 124.8 ms
Range 133.8 ms
Test code
C · main.c
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct{int64_t value;}Counter;typedef struct{int64_t *value;}View;
int main(int argc,char**argv){
    int64_t n=argc>1?atoll(argv[1]):40000000,checksum=0;
    Counter *counter=malloc(sizeof(*counter));counter->value=0;
    View *view=malloc(sizeof(*view));view->value=&counter->value;
    for(int64_t i=0;i<n;i++){counter->value=i+1;checksum=(checksum+*view->value)%1000003;}
    printf("%" PRId64 "\n",checksum);
}
Range · Playground.range
construct View { binding values: [Int] }
@main {
    state values: [0]
    let view: View(values: $values)
    state i: Int(0)
    state checksum: Int(0)
    while i < 40000000 {
        view.values[0]: i + 1
        checksum: (checksum + values[0]) % 1000003
        i: i + 1
    }
    return checksum % 251
}

Identity

Repeated child replacement

40m replacements · 30 runs

Replace a state-owned child identity repeatedly; equivalent languages may reclaim unreachable children while Range bulk-reclaims its arena at exit

Range 223.1 ms
Go 294.1 ms
Range malloc 499.3 ms
C 519.7 ms
C++ 575.9 ms
Rust 592.0 ms
Swift 864.7 ms
Test code
C · main.c
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct{int64_t value;}Child;typedef struct{Child *child;}Root;
int main(int argc,char**argv){
    int64_t n=argc>1?atoll(argv[1]):40000000,checksum=0;Root root={malloc(sizeof(Child))};root.child->value=0;
    for(int64_t i=0;i<n;i++){Child*next=malloc(sizeof(*next));next->value=i+1;free(root.child);root.child=next;checksum=(checksum+root.child->value)%1000003;}
    printf("%" PRId64 "\n",checksum);free(root.child);
}
Range · Playground.range
construct Child { let value: Int }
construct Root { state child: Child }
@main {
    let root: Root(child: Child(value: 0))
    state i: Int(0)
    state checksum: Int(0)
    while i < 40000000 {
        root.child: Child(value: i + 1)
        checksum: (checksum + root.child.value) % 1000003
        i: i + 1
    }
    return checksum % 251
}
4 of 15 leaves runRange passed 4Not emitted 0Failed 0

Initial benchmark

July 18, 2026

Loops

20m iterations
C++ 61.3 msabsolute best
C 61.4 ms
Rust 61.9 ms
Swift 62.5 ms
Range 66.3 ms
Go 79.6 ms

Noise

50m samples
C 70.5 msabsolute best
C++ 70.9 ms
Go 78.9 ms
Range 82.4 ms
Rust 82.9 ms
Swift 82.9 ms

Function Calls

20m iterations
Go 64.2 msabsolute best
C++ 67.4 ms
C 67.5 ms
Rust 67.9 ms
Swift 68.5 ms
Range 72.3 ms

Strings

100k appends
C++ 3.6 msabsolute best
Rust 3.6 msabsolute best
Go 4.3 ms
C 4.4 ms
Swift 4.8 ms
Range 491.2 ms

Range peak memory: 5.3 GB · peers: 1.8–4.2 MB

Compiler status

4 of 6 tests emitted and passed

  • Collections · resolution stage 2
  • Constructs · constructor-argument parse reachability

Updates

Strings Go Fast100k appends · 491.2 ms → 4.1 ms
GitHub
Range · native LLVM · O3July 2026