Files
bux-lang/benches/nim/int_loop.nim
T
dimgigov eb81856565 feat: HTTP registry, app/bench harnesses, and DWARF #line maps
Ship QUALITY_PLAN sessions 31–33: fetchable package index URLs, showcase
app and micro/nexus benchmarks, and debugger-friendly C codegen.

- Registry: BUX_REGISTRY accepts http(s) URLs (curl/wget → ~/.bux/cache)
- E.2: make test-apps smoke for nexus/boko/simpledb/jwt-pitbul
- E.5: benches/micro + C/Nim/Zig twins; make bench-nexus (wrk)
- E.4: HIR locs → #line .bux; default -O0 -g; --release -O2; make test-dwarf
2026-07-19 22:46:45 +03:00

16 lines
410 B
Nim

## Nim twin of benches/c/int_loop.c — 1e6 integer arithmetic loop
import std/[times, strformat]
proc nowUs(): int64 =
int64(epochTime() * 1_000_000.0)
const iters = 1_000_000
var acc = 0
let t0 = nowUs()
for i in 0 ..< iters:
acc = acc + i * 3 - 1
let t1 = nowUs()
if acc == 0 and iters > 0: quit(1)
let total = t1 - t0
echo &"BENCH int_loop iters={iters} total_us={total} us_per_op={total div iters}"