Constructs
Identity · Repeated child replacement
Replace a state-owned child identity repeatedly; equivalent languages may reclaim unreachable children while Range bulk-reclaims its arena at exitIdentity
Repeated child replacement
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
#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);
}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
}Measurements
Range passed
| Language | Wall | CPU | Peak memory | Relative | Output |
|---|---|---|---|---|---|
| Range | 223.1 ms | 219.1 ms | 384.6 MB | 1.00× | exit:112 |
| Go | 294.1 ms | 304.7 ms | 10.0 MB | 1.32× | 7140 |
| Range malloc | 499.3 ms | 493.1 ms | 614.4 MB | 2.24× | exit:112 |
| C | 519.7 ms | 517.0 ms | 1.6 MB | 2.33× | 7140 |
| C++ | 575.9 ms | 572.1 ms | 1.6 MB | 2.58× | 7140 |
| Rust | 592.0 ms | 588.7 ms | 1.8 MB | 2.65× | 7140 |
| Swift | 864.7 ms | 861.7 ms | 2.1 MB | 3.87× | 7140 |
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
N=<base-iterations> RUNS=<sample-count> npm run benchmarkscc -O3 -mcpu=native main.c -o speed-c
./speed-c <iterations>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.