Skip to content
Benchmark

Benchmark

Grey PVM Benchmark Results

Grey’s RISC-V recompiler vs PolkaVM’s compiler backend, measured on 8 workloads covering compute, memory, crypto, and host call patterns.

Methodology

Gas metering model: Pipeline gas metering (POLKAVM_DEFAULT_COST_MODEL=full-l1-hit). This charges gas per basic block based on instruction count, matching the JAR v0.8.0 specification. Both Grey and PolkaVM use synchronous gas metering under this model.

Why compile+execute matters: In JAM, every work-package arrives as a PVM blob that must be compiled and executed from scratch. There is no persistent code cache across invocations – each validator independently compiles the blob before execution. The compile+execute measurement reflects this real-world cost. We report exec-only numbers separately for engineering insight, but the full pipeline is the metric that determines block processing time.

Benchmark fairness:

  • Both VMs compile from the same source (Rust, compiled to RISC-V, transpiled to PVM for Grey / compiled to PolkaVM format for PolkaVM)
  • Grey recompiler uses mprotect-based bounds checking (always enabled on x86-64 Linux)
  • PolkaVM uses generic sandbox with POLKAVM_ALLOW_EXPERIMENTAL=1
  • Criterion statistical framework, 100 samples per benchmark (10 for ecrecover)
  • Same host machine, same gas limit, same workload parameters

Reproduction:

POLKAVM_ALLOW_EXPERIMENTAL=1 POLKAVM_DEFAULT_COST_MODEL=full-l1-hit \
  cargo bench -p javm-bench

Results: Compile + Execute (full pipeline)

This is the number that matters for blockchain performance.

BenchmarkGreyPolkaVMSpeedup
fib414 us428 us1.03x
hostcall799 us3,175 us3.97x
sort398 us460 us1.16x
sieve351 us353 us1.01x
blake2b90 us276 us3.07x
keccak51 us140 us2.75x
ed25519977 us1,349 us1.38x
ecrecover1,465 us3,319 us2.27x

Grey wins all 8 benchmarks. The advantage ranges from 1.01x (sieve) to 3.97x (hostcall), with a geometric mean speedup of ~1.9x.

The primary driver is compilation speed: Grey’s single-pass x86-64 code generator compiles PVM bytecode approximately 3x faster than PolkaVM’s compiler backend. For short programs (blake2b, keccak) where compilation dominates total time, this translates directly into large end-to-end wins. For long-running programs (fib, sieve) where execution dominates, the two VMs converge.

Results: Execution Only

Compilation performed in setup (untimed). Measures native code quality in isolation.

BenchmarkGreyPolkaVMSpeedup
fib408 us409 us1.00x
hostcall816 us3,213 us3.94x
sort398 us436 us1.10x
sieve304 us320 us1.05x
blake2b13.2 us27.0 us2.05x
keccak18.1 us35.9 us1.98x
ed25519140 us158 us1.13x
ecrecover630 us579 us0.92x

Grey wins 7 of 8 benchmarks on exec-only. PolkaVM’s only win is ecrecover (1.09x). Grey generates notably better native code for hash functions (blake2b 2.0x, keccak 2.0x) and host call dispatch (3.9x). The hostcall result is notable: PolkaVM’s compiled code (3,213 us) is actually slower than its own interpreter (2,526 us) on this workload, suggesting high overhead in its compiler’s host call dispatch path.

Results: Interpreters

BenchmarkGreyPolkaVMSpeedup
fib9.0 ms9.1 ms1.01x
hostcall795 us2,526 us3.18x
sort8.1 ms11.8 ms1.46x
sieve2.7 ms3.0 ms1.14x
blake2b194 us341 us1.76x
keccak182 us211 us1.16x
ed255195.1 ms3.2 ms0.63x
ecrecover21.0 ms19.3 ms0.92x

Grey’s interpreter wins 6 of 8. PolkaVM wins ed25519 (1.6x) and ecrecover (1.1x).

Workload Descriptions

BenchmarkDescriptionCharacter
fibIterative Fibonacci, 1M iterationsPure compute (add, branch)
hostcall100K ecalli invocationsHost call dispatch overhead
sortInsertion sort, 1K u32 elementsCompute + memory interleaved
sieveSieve of Eratosthenes to 100KMemory + branching
blake2bBlake2b-256, 1KB messageCrypto: rotate, xor, add
keccakKeccak-256, 1KB messageCrypto: rotate, xor, and
ed25519Ed25519 signature verifyCrypto: multiply-heavy
ecrecoversecp256k1 ECDSA key recoveryCrypto: heavy multi-precision

Environment

  • Date: 2026-03-30
  • Grey: javm recompiler (mprotect bounds checking)
  • PolkaVM: v0.32.0, generic sandbox, full-l1-hit cost model
  • Rust: 1.94.1, release mode
  • Hardware: Intel Core i9-13900K