You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if making multiple instruction invocations into the same program, a significant amount of overhead is required.
Copying data from bpf memory into keyed accounts.
Verification of intermediate account data against a reference (PreAccount).
Verification of resultant data from process_instruction against reference.
Copying data back into bpf memory.
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:
jon-chuang
changed the title
Batching same-program instruction invocations to save on overhead
Batching same-program instruction invocations to save on context-switch overhead
Jul 6, 2021
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: