mode=fast on /build to reduce routing latency at the cost of quote optimality.
How it works
Fast mode optimises for speed in two ways:- Bellman-Ford with no splitting: the routing algorithm uses Bellman-Ford without splitting the route across multiple pools. This reduces computation time significantly, at the cost of potentially missing better multi-pool routes.
- Parallel priority fee lookup: the
getRecentPriorityFeeRPC call runs in parallel with the call to Metis routing engine to get the swap instructions, instead of sequentially. This eliminates the RPC round-trip from the critical path.
When the
getRecentPriorityFee is done in parallel and not sequentially, this can impact the final priority fee estimation.This is because, when done sequentially, we are able to first get the swap instructions which includes the writable accounts, which then enables the getRecentPriorityFee to include these writable accounts (hot accounts) to be factored into the estimation.When to use
- You are swapping high-frequency and need low latency
- The pair is well-known (e.g. SOL/USDC) and doesn’t benefit from complex routing
- You are building a trading bot where speed matters more than optimising the last basis point
Trade-offs
Fast mode may return suboptimal pricing compared to the default mode because:- No as accurate priority fee estimation as mentioned above
- No route splitting means the entire amount goes through a single pool path
- Fewer route combinations are explored
Related
- Reduce Transaction Size for controlling account count
- Build Custom Transactions for the full
/buildworkflow
