This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
Batching same-program instruction invocations to save on context-switch overhead #18428
Labels
stale
[bot only] Added to stale content; results in auto-close after a week.
Problem
Currently, if making multiple instruction invocations into the same program, a significant amount of overhead is required.
The chosen number to reflect these costs is 1000 compute unit cost per CPI. That's not particularly high, but is about 20-25% of a typical Serum tx. Raydium TX, which typically call serum CPIs 10-20 times per TX, can save up to 20,000 CUs, bringing down median cost from 85,000 to 65,000, allowing greater composability with Raydium.
Proposed Solution
Allow batching of multiple instructions into a single syscall. This can get rid of extra data copies per CPI.
In this proposal, we ignore saving on verification - since verification even in between instructions executed for the same program may be a desirable property anyhow, while opening up the possibility of batching instructions from different programs.
Todo
Investigate just how much time-cost savings there could be in batching. It's probably on the order of 10s of microseconds per invoke. Which maybe isn't significant enough to justify the effort ...
The text was updated successfully, but these errors were encountered: