Skip to main content

Crate javm_bench

Crate javm_bench 

Source
Expand description

Shared runners for benches/pvm_bench.rs and benches/stark_bench.rs.

The bench measures the full per-invocation lifecycle:

  • Nub::put_cap_with_hash for each cap the invocation requires (Data blobs the Image references, the Image itself, the empty root cnode, the Instance). Each put is a single BTreeMap::get + refcount.fetch_add(1) after warm-up — i.e. a few tens of nanoseconds per cap.
  • Nub::invoke_cached(instance_hash, endpoint, args, gas).
  • run_interpreterNub::new_local() drives the byte-PVM interpreter (javm-exec) in-process.
  • run_recompiler — a long-lived Nub::new_hyperlight() sandbox (cached in a OnceLock) drives the in-kernel JIT path through the same invoke_cached API.

BuiltCaps holds the pre-built Cap graph + its precomputed hashes. Construction happens once per workload at bench warm-up via BuiltCaps::for_image; the iter loop reuses the resulting handles.

Linux x86-64 only — nub pulls the Hyperlight host stack unconditionally.

Structs§

BuiltCaps
Pre-built Cap graph for one (image, endpoint) bench cell.

Functions§

run_interpreter
Drive built[endpoint_idx] through the byte-PVM interpreter via a fresh Nub::new_local() (the Local backend has no per-invocation state, so a fresh Nub each call is fine — and matches the chain’s per-event allocation model).
run_recompiler
Drive built[endpoint_idx] through the in-kernel JIT via the long- lived Hyperlight Nub.