forgo.cloud
Sign in
Repo workspace

forkjoin-ai/gnosis

PhysicalQuasicrystallineClock -- Benchmarks

docs/physical-clock-bench.md
forkjoin-ai/gnosis

PhysicalQuasicrystallineClock -- Benchmarks

Host: Apple Silicon (darwin 24.5.0), Bun 1.3.10, single thread. Run: bun run open-source/gnosis/src/quasicrystalline-physical-clock-bench.ts

Headline

Operation Iters ops/sec
Date.now() (baseline) 5,000,000 ~19,600,000
process.hrtime.bigint() (baseline) 5,000,000 ~7,250,000
PhysicalClock.now() 1,000,000 ~1,980,000
PhysicalClock.validate(reading) 1,000,000 ~990,000

Interpretation

  • now() runs at ~2 M ops/s -- about 10x slower than the raw Date.now() baseline and ~3.6x slower than process.hrtime.bigint(). The overhead is the lattice-index encoding plus the Fibonacci witness lookup.
  • validate() runs at ~1 M ops/s. It does a Cassini phase check, a witness re-derivation, and a drift comparison, plus an internal now() call to read the local position -- so ~half the cost is the local re-read.
  • The trajectory ring-buffer is bounded (default 1024) and contributes amortized O(1) cost.

Production polling rate

NTP synchronizes at most every few seconds; PTP at ~100 Hz; tightly-coupled distributed inference might want kHz. At ~2 M now() ops/s the clock is ~20,000x headroom over a 100 Hz polling target and ~2,000x headroom over a 1 kHz target. The cost is invisible at any realistic rate.

Comparison vs raw Date.now()

The physical clock costs ~10x the raw clock call, in exchange for:

  • Cassini-checked witness on every reading (kernel-level corruption detection)
  • Lattice index ready for fork/race/check fold-time
  • Lipschitz-1 drift metric the Lean spec already proved bounded

The 10x is the price of provable corruption detection plus topological ordering. For any non-tight inner loop it is free.