Benchmarks

Constructs

Identity · Eight-level nested chain

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

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
}

Measurements

Range passed

LanguageWallCPUPeak memoryRelativeOutput
Range111.0 ms108.0 ms269.7 MB1.00×exit:78
C273.9 ms268.0 ms491.8 MB2.47×78
C++298.5 ms293.3 ms491.8 MB2.69×78
Rust309.5 ms303.3 ms492.0 MB2.79×78
Range malloc315.4 ms310.6 ms430.5 MB2.84×exit:78
Go407.0 ms2147.5 ms344.9 MB3.67×78
Swift446.7 ms443.3 ms1013.0 MB4.02×78

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.