Baseline numbers for Soroban CPU instruction cost and memory usage across the three core order execution scenarios. Generated by running:
cargo bench -p order-handler --bench order_execution
Note: Benchmarks are excluded from CI (
cargo test) because they are too slow for routine checks. Run them locally or in a dedicated perf job withcargo bench -p order-handler --bench order_execution.
| Scenario | CPU Instructions | Memory (bytes) | DS Reads | DS Writes | XC Calls |
|---|---|---|---|---|---|
| create_order | — | — | 2 | 4 | 3 |
| execute_order | — | — | 8 | 6 | 5 |
| full_cycle | — | — | 18 | 14 | 10 |
Fill in CPU and memory columns by running the bench and reading the
[bench] <scenario> cpu=… mem=…lines printed to stderr.
| Metric | How it is measured |
|---|---|
| CPU Instructions | env.cost_estimate().budget().cpu_instruction_cost() after a reset to default limits |
| Memory (bytes) | env.cost_estimate().budget().mem_bytes_cost() |
| DS Reads | manual count of DataStoreClient::get_* calls in the hot path |
| DS Writes | manual count of DataStoreClient::set_* / add_* calls |
| XC Calls | number of cross-contract invocations (oracle, vault, role_store) |
- Issue #242 —
validate_positionwas inlined intolibs/position_utils(called as a library function fromincrease_position_utils/decrease_position_utils), eliminating at least one cross-contract round-trip per order execution. - Issue #245 — All fee-computation paths use the named
TOKEN_PRECISIONconstant fromlibs/math; no bare10_000_000literals remain. - Future work tracked in issues #239–#242.