Performance Analysis

STYLUS vs SOLIDITY

Real gas measurements from Arbitrum Sepolia with 60 resting orders.
WASM wins on compute-heavy hot paths. Storage stays break-even.

Order Book Operations

60 RESTING ORDERS // ARB SEPOLIA
get_active_orders_sorted (cap=20)↓ 31% savings
STYLUS
759k
SOLIDITY
1103k
get_active_orders_sorted (cap=30)↓ 34% savings
STYLUS
762k
SOLIDITY
1159k
match_orders (full scan)↓ 1% savings
STYLUS
788k
SOLIDITY
792k
store_order (cumulative 60)+9% overhead
STYLUS
13740k
SOLIDITY
12662k
34%
Peak Savings
get_active_orders_sorted
11.1 KB
Contract Size
WASM binary (optimized)
761k
Hot Path
gas (vs 1.16M Solidity)
5
Guardrail Checks
on-chain validations

Guardrail Validation Cost

ESTIMATED // PER CHECK
Asset Whitelist
2100
5200
↓ 60%
Max Leverage
1800
4800
↓ 63%
Position Size Cap
2400
6100
↓ 61%
Daily Volume
3200
8400
↓ 62%
Min Collateral
1600
4200
↓ 62%
Total 5-check validation
WASM: ~11,100 gasEVM: ~28,700 gas↓ 61% savings

Methodology

EnvironmentArbitrum Sepolia (chain 421614). Both contracts deployed with identical logic. 60 resting orders pre-populated by the AI Market Maker.
MeasurementGas measured via tx.wait().gasUsed on confirmed transactions. Each operation run 3x, median reported.
ConclusionStylus excels on compute-heavy paths (sort, scan). Storage-only operations break even. We use WASM where it matters: the hot path called on every page render.