Order book · PocketIC
The cost of acknowledging a signed order
A signed order took 2,259,331 canister instructions to acknowledge on RSX with Reactor, Takt and RSX Schnorr. That was 60.9% fewer than DFINITY Rust sending one action per call, and 35.8% fewer than the same Rust build grouping 16 at a time.
One receipt per completed action
Scroll the table sideways to compare the builds.
| Measured work | DFINITY Rust · one action per call | DFINITY Rust · grouped ingress | RSX · grouped ingress, direct peer call | RSX · direct peer call and Takt | RSX · Reactor and Takt | RSX · Reactor, Takt and RSX Schnorr |
|---|---|---|---|---|---|---|
| Canister instructions per acknowledged action | 5,776,188 | 3,517,257 | 3,274,919 | 3,312,032 | 3,457,035 | 2,259,331 |
| Total canister instructions | 1,478,704,208 | 900,418,023 | 838,379,399 | 847,880,339 | 885,001,021 | 578,388,892 |
| Acknowledged actions | 256 | 256 | 256 | 256 | 256 | 256 |
| Ingress update calls | 256 | 16 | 16 | 16 | 16 | 16 |
| Calls between distinct canisters | 256 | 16 | 16 | 16 | 8 | 8 |
| Self-calls | 0 | 0 | 0 | 0 | 34 | 34 |
| p95 acknowledgment latency, simulated ms | 500 | 500 | 500 | 500 | 500 | 500 |
For each build, we divide total canister instructions by the number of actions that returned their expected receipt. The table shows whole instructions per action, rounded down.
Follow a signed order to its receipt
- A trader signs the order details. A peer can group several signed actions in one packet. The receiving collector verifies each BIP340 Schnorr signature with the public key for its trader.
- Placing a bid reserves quote funds. Placing an ask reserves inventory. The collector contacts the book canister, which adds the order. Canceling removes it and releases the reservation.
- Once the book and collector have both saved their changes, the client receives the action back as its receipt. A retry of the same signed action returns the original receipt.
Each trader starts with 256 standing orders on the shared book. The two traders then place 64 new orders each in one burst. Once every placement has a receipt, they cancel those 128 orders in a second burst. Bid and ask prices stay apart throughout, so the 256 receipts count placements and cancellations. Trade matching and settlement are outside this workload.
Where the instruction count changes
Both DFINITY runs use the same Rust canister and stable B-trees. Grouping 16 actions per call cut both ingress updates and peer calls from 256 to 16. That change alone saved 39.1% of its instructions.
- DFINITY Rust · one action per call
- 5,776,188
- DFINITY Rust · grouped ingress
- 3,517,257
- RSX · grouped ingress, direct peer call
- 3,274,919
- RSX · direct peer call and Takt
- 3,312,032
- RSX · Reactor and Takt
- 3,457,035
- RSX · Reactor, Takt and RSX Schnorr
- 2,259,331
With the same packet size and RustCrypto verifier, DFINITY Rust used 900,418,023 instructions in total. RSX with Reactor and Takt used 885,001,021, a 1.7% saving. Switching that RSX build to its own BIP340 verifier brought the total to 578,388,892. The verifier prepares the trader’s key once per packet and checks every signature independently.
On RSX, the order book and receipt journal live in persistent Nyxus maps. The direct-call control updates them in ordinary Rust. The Takt control uses two ready workflow steps in the same execution to check the book and commit the update.
Reactor carried 16 book requests and their 16 results in 8 calls between canisters. The collector waited for the book’s result before replying to the trader. With the same verifier, this reduced peer calls from 16 to 8 and raised total instructions by 4.4%. The extra work includes durable message tracking and self-calls to collect results.
Memory-page charges show why grouping helps. DFINITY Rust spent 368,640,000 instructions on heap-page access with single-action calls and 23,040,000 with grouped calls. The complete RSX path spent 74,240,000 on that charge. These builds change both storage and execution, so this comparison cannot assign a saving to the allocator alone.
What the counters include
Both waves start with all signed actions ready. The host sends them over local TCP connections, groups them by trader and submits every ingress packet for the wave before advancing PocketIC. Signing, peer collection time and Internet travel sit outside the simulated latency window. This models two bursts on one application subnet.
Canister traces cover every measured ingress execution, peer request, callback and timer on the three application canisters, including two extra rounds after the final reply in each wave. A request from a collector to the book counts once in the peer-call total. The reply’s callback instructions count toward the guest charge. Calls a canister sends to itself appear separately in the table. The guest charge includes metered system calls and memory-page access. Setup, read-only snapshot checks, upgrades, replica scheduling overhead and host CPU time fall outside these counts.
Latency runs from submission to the final ingress reply on the PocketIC clock. A packet’s reply time applies to every action it carries. The table shows when 95% of all actions had their receipts. A time of 500 ms means the reply was visible at the first observation. PocketIC’s 500 ms clock ticks leave differences within that first tick unmeasured.
The next benchmark measures cycles per acknowledged action
The current run measures instructions for two bursts of individually signed actions. The next comparison will give RSX and DFINITY Rust the same signed packs, ingress batch sizes and offered action rate. Both builds will verify each pack in replicated execution, persist the same changes and return a durable receipt for every completed action. A second DFINITY run will send one pack per call to measure what ingress batching saves.
We’ll report the total cycles charged across all participating canisters through the final drain, the number of acknowledged actions, and the cycles per acknowledged action. Beside those costs we’ll show ingress and inter-canister call counts and p95 acknowledgment latency from action arrival, including time spent filling a pack.
A 99% cost reduction would require DFINITY Rust to spend at least 100 times as many cycles per acknowledged action as RSX at that load. The batching figures from Showtime and Heavy16 measure how much fits in a call. The matched cycle measurements are still to come.
Check the result
The runner checks the signed action bodies in the receipts and compares the open orders, account balances and accepted actions after placement and after cancellation. It also checks duplicate and conflicting requests, refusals and a same-build upgrade on all three canisters.
Each configuration ran twice from a fresh install. Both repetitions produced the counts shown here. The JSON includes the per-canister counts, receipt and state hashes, Wasm hashes and PocketIC binary hash. The archive retains the exact Wasm binaries from the SDK checkout used for the runs.
To repeat the run, extract the source archive, put the JSON and canister archive beside driver.mjs, and follow its README. Set RSX_CHECKOUT to the SDK checkout and POCKET_IC_BIN to the pinned Linux runtime. Both SDKs used the same Rust nightly. The measured Wasm binaries preserve the SDK checkout’s local changes. Download the pinned PocketIC runtime (306 MiB).