Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.99 KB

File metadata and controls

43 lines (33 loc) · 1.99 KB

Performance Baseline — Order Execution Cycle

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 with cargo bench -p order-handler --bench order_execution.

Soroban Budget Metrics

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 Definitions

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)

Optimisation Notes

  • Issue #242validate_position was inlined into libs/position_utils (called as a library function from increase_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_PRECISION constant from libs/math; no bare 10_000_000 literals remain.
  • Future work tracked in issues #239–#242.