Low-Latency Architecture for Solana HFT

Low-Latency Architecture for Solana HFT

Low-Latency Architecture for Solana HFT
Data is arriving, yet the prices your application uses to make decisions are still out of date. In a Solana HFT application, you need to examine both the time spent computing and the time received data spends waiting before it informs a decision. Earlier updates may still be waiting for processing, a log write may be unfinished, or another market's update may be holding a lock. The way you organize your code changes these waits.
This article follows where incoming data waits and what can move forward when the design changes, using five patterns. You can also start with the symptom that matches your application and go directly to that section.
What is happening in the applicationDesign to examine
Unprocessed data keeps growing the longer the application runs1. Arrival rate, processing rate, and limits on waiting
The next price cannot be processed while a record is being saved2. Separating decision-critical work from analytical logging
An update to market A makes an update to market B wait3. Splitting locks that protect independent state
The same preparation is repeated for every arrival4. Preparing unchanged parts in advance and reusing them
Decisions use old values even after the connection returns5. Distinguishing connection recovery from recovery of decision state
Each section ends with copyable instructions for applying that improvement to your application. Give them to an AI agent that can read your project's code.
The counts, prices, operation counts, and durations in the diagrams are illustrative models. They do not represent measured performance or trading outcomes.
Select a diagram to open the full-size image.

1. Compare arrivals with processing capacity and set limits on waiting

Consider an application that receives six events and can process two in each equal-length time interval. At the end of the first interval, four events remain unprocessed. A queue is where data waits to be processed.
Six arrivals are represented by six dots. Two have been processed, while four remain in the queue and carry over into the next interval.
Processing is moving forward, but four events have not yet been used for decisions.
Now scale the same ratio to 60,000 incoming events. Processing 20,000 leaves 40,000 waiting. On the right side of the diagram, each dot represents 100 events, and each group of 100 dots represents 10,000 events. Two groups have been processed, and four groups remain waiting.
On the left, each dot represents one event: two of six events have been processed and four are waiting. On the right, each dot represents 100 events and each group contains 100 dots: 20,000 of 60,000 events have been processed and 40,000 are waiting.
The groups on the right are a way to show volume. They do not represent processing batches in the application.
The next interval begins with 40,000 events already waiting. Another 60,000 arrive and 20,000 are processed, leaving 80,000. The following interval ends with 120,000. Newly arriving prices must wait behind work that is already in the queue.
With 60,000 arrivals and 20,000 events processed in each interval, the unprocessed backlog grows from 40,000 to 80,000 to 120,000.
When arrivals continue to exceed processing capacity, the backlog keeps growing.
A queue helps absorb bursts: short periods when arrivals are concentrated. Increasing its capacity does not resolve a sustained processing deficit like the one in this example. In addition to the number of items and bytes retained, observe how long the oldest item has been waiting and set an acceptable limit. If the required freshness is no longer met, pause new trading decisions that depend on those values even if no updates have been lost.
What should happen when that limit is reached? In the next diagram, all eight available slots are full when two more updates arrive. If those two updates cannot be retained and are required for a decision, the application can no longer update its stored values correctly. Pause new trading decisions that depend on those values and resume after recovering the necessary updates.
Eight retention slots are full, so two updates required for a decision cannot be retained. The missing updates cause the affected trading decisions to be paused.
A queue design also needs to define what happens after its limit is reached.
Review whether you can reduce the work or increase processing capacity. If a consumer needs only the latest complete state of the same entity, it may be possible to coalesce intermediate values into the latest one. For a process that accumulates deltas or needs intermediate events, however, omitting updates changes the result.
Pausing reception may also move the wait upstream. Consider gRPC flow control, which regulates the pace of sending and receiving, together with server-side filters that narrow the subscribed data and the application's actual processing capacity.[3][4]
To improve receive-queue capacity and data freshness in your application, copy these instructions.
text
Improve this application's handling of incoming data when processing falls behind and the data used for decisions becomes stale.

Read the README, development instructions, dependencies, and receipt → queue → state update → decision code. Work with the existing language, runtime, and SDK. Establish whether updates contain complete state or deltas, their required application order, and the freshness requirement.

1. Save reproducible input without confidential information and record the baseline. Inspect waiting before queue entry as well. Measure incoming and outgoing item and byte counts over the same interval, queued work, the age of the oldest waiting item, and work in progress.
2. Define and implement limits on items, bytes, waiting time, and concurrency, with a reason for each. State assumptions where requirements are unknown. Check whether unnecessary reception or processing can be reduced and whether processing capacity is sufficient. Do not treat a larger queue alone as a solution to a sustained processing deficit.
3. Define what happens when the queue is full. If required updates cannot be retained, or required freshness is lost even without missing updates, pause new trading decisions that depend on those values. Continue state updates and recovery, and verify the conditions for resuming.
4. If coalescing intermediate values, establish that the latest complete state of the same entity is sufficient to preserve the result. Do not silently discard required deltas or events. If pausing reception, check the provider's flow-control behavior and where waiting moves.
5. Replay normal input, bursts, sustained overload, and recovery from a full queue under matching conditions. Compare arrival and processing rates, oldest-item age, receipt-to-decision p50/p95/p99, CPU and memory, and missing or discarded updates. Check applied state and decisions against the expected results. Use a monotonic clock for elapsed time within a host, and state the measurement boundaries.

Carry forward existing approvals, permissions, and development procedures. Do not treat these instructions alone as additional permission to change production, enter paid contracts, or conduct live trades. Do not output private keys, credentials, or customer data.

Report the changes, comparison conditions, before-and-after measurements, correctness checks, and remaining limitations. Mark values that cannot be measured as unmeasured.

2. Process the next price without waiting for a record to be saved

Consider a market price changing from 100 to 101. The application has applied 100, completed its decision, and is saving an analytical record. If the loop that handles incoming data waits for that save to finish, it cannot apply 101 even when the update arrives. The application's stored price remains 100.
While the analytical record for price 100 is being saved, the arriving price 101 waits to be applied, leaving the application's stored price at 100.
The reason processing cannot begin for 101 is the wait for the record of 100.
Now hand the analytical record to an auxiliary queue with available capacity and let a separate operation save it. The receiving loop can return to the next input once the handoff is complete. It can apply 101 and proceed to a decision while the save for 100 is still in progress.
The following comparison keeps the save duration for 100, the arrival time of 101, and the time needed to process 101 the same. What changes is whether moving to the next input depends on the save finishing.
The before and after designs share the same timeline. The save interval for the record of 100, the arrival time of 101, and the length of the processing interval for 101 are identical. Before the change, 101 waits for the save to finish. After the change, processing can apply 101 and make a decision after handing the record to the auxiliary queue.
Even without shortening the work for 101 itself, you can reduce the wait before it begins.
The processing path required from receipt through decision and submission is called the hot path. In this example, analytical logging that does not need to delay the decision is moved off that path. Balance checks, risk-limit checks, and saves that must finish to preserve correctness stay where the requirements demand them.
The saving work still exists, so the auxiliary queue also needs capacity and waiting-time limits. A separate task does not necessarily run on a separate CPU. Long CPU-bound or blocking operations in Tokio, and long synchronous operations on the Node.js event loop, can prevent other work from progressing. When moving work, check where it will actually execute.[1][2]
To separate analytical-log writes from the decision path, copy these instructions.
text
Improve this application where waiting for analytical records to be saved prevents the next update from being applied or used for a decision.

Read the README, development instructions, dependencies, and receive loop. Work with the existing language, runtime, and storage library. Locate waits for save completion and identify the threads, tasks, or event loops where the work actually runs.

1. Prepare reproducible input without confidential information. Record receipt, state application, decision start and completion, save start and completion, and the current results.
2. Establish from the requirements whether save completion is a prerequisite for decisions or recovery. Keep balance checks, risk checks, and correctness-critical persistence where they are required. Separate analytical records whose saving may finish later.
3. Define how records are handed off so that later state changes cannot alter the values being recorded. Implement a bounded auxiliary queue and a saving consumer. Specify item, byte, and waiting-time limits; behavior on a full queue, save failures, retries, and shutdown; and retention requirements. Do not discard records while retention requirements remain unknown.
4. Do not assume that a separate task runs on another CPU. Check where synchronous I/O and long CPU work execute. If using workers or similar facilities, limit concurrency and include conversion, copying, and handoff waiting in the evaluation.
5. Use the same input and arrival pace to reproduce normal saves, slow saves, failures, a full auxiliary queue, and shutdown. Compare receipt-to-decision p50/p95/p99, saving-side waiting and backlog, CPU and memory, and missing or duplicated records. Verify state and decision correctness and record-retention requirements. Use a monotonic clock for elapsed time within a host, and state the measurement boundaries.

Carry forward existing approvals, permissions, and development procedures. Do not treat these instructions alone as additional permission to change production, enter paid contracts, or conduct live trades. Do not output private keys, credentials, or customer data.

Report the changes, comparison conditions, before-and-after measurements, correctness checks, and remaining limitations. Mark values that cannot be measured as unmeasured.

3. Do not make independent updates wait for the same lock

Consider an application that can update the prices of markets A and B independently. An update for B arrives after the update for A has started. If a single mutex protects both A and B, B has to wait until A releases that lock.
A mutex grants one operation at a time the right to access the protected data. If another operation is using it, an operation trying to acquire the same lock waits.[17]
An update for market B arrives while the update for market A holds the shared lock. B waits through the pink interval and begins its update at the point where A releases the lock.
B's data has arrived, but it is waiting for the shared lock held by A.
If A and B each modify separate values, one option is to protect them with separate locks. The upper half of the next diagram uses a shared lock; the lower half uses separate locks. Arrival positions and lock-holding durations for A and B are identical in both halves. The example assumes B's lock is free and there is execution capacity available for B. Tokio's official tutorial also describes mutex sharding for data with independent keys.[18]
The upper half shows markets A and B using a shared lock; the lower half shows separate locks. Arrival positions and lock-holding durations for A and B are identical in both halves. In the upper half, B waits for A to release the lock. In the lower half, B begins its update when it arrives.
B's blue bar has the same length. The removed portion is the pink waiting interval before it.
The blue bar covers the time from acquiring the lock to releasing it. In this example, B finishes while A is still updating. Separate locks do not remove a wait caused by B's own lock being in use or by other work occupying the available execution resources.
Before splitting a lock, establish which updates are independent. Even if the prices for A and B can be updated separately, a decision that uses both prices or a shared balance still needs a way to read the required values consistently. Values can change while an operation is suspended at an await, even on the same thread. Define which versions a decision reads, how it reads them, and the order in which updates are applied.
For example, if A and B read the same balance and each build an order, they may both count on spending the same funds. Shared values still need their own protection, such as a single owner that checks the balance and reserves funds for each order in sequence.
Another option is to give each state a single update owner and send update messages to it. This is the Single Writer principle. Splitting locks and choosing a single writer are separate design decisions. LMAX Disruptor describes Single Writer and processing dependencies, while Tokio describes managing state through messages to a dedicated task.[5][18]
To reduce lock waiting between independent state updates, copy these instructions.
text
Improve this application where an update for one market or key makes an independent update wait for the same shared lock.

Read the README, development instructions, dependencies, and code that reads or writes state, acquires locks, or awaits other work. Use the existing language and runtime. Identify who updates each value and which sets of values each decision reads.

1. Save reproducible input without confidential information and record the baseline. For contended locks, record arrivals by key, acquisition waiting, holding time, update order, and the state versions used for decisions.
2. Distinguish independently updatable values from values whose consistency must be protected together. Split locks around independent state, and make each key's application order and write ownership explicit. Keep the number of locks or processing owners under control.
3. Protect decisions that span markets and shared balances or fund reservations. Make balance checking and reservation one coordinated operation so that multiple orders cannot each assume the same funds are available. Define an acquisition order if multiple locks are needed.
4. Inspect state changes across await points and completion order during parallel decoding. Define which versions a decision reads and how it reads them. Do not let decode completion order replace the required application order. After splitting locks, check whether execution-resource limits or contention on the same key still cause waiting.
5. Replay the same input and arrival order with independent keys, concentrated updates to one key, competing reservations of shared funds, and suspended and resumed work. Compare lock waiting, receipt-to-decision p50/p95/p99, CPU, and memory. Verify required update order, consistent decision state, and absence of double reservation. Use a monotonic clock for elapsed time within a host, and state the measurement boundaries.

Carry forward existing approvals, permissions, and development procedures. Do not treat these instructions alone as additional permission to change production, enter paid contracts, or conduct live trades. Do not output private keys, credentials, or customer data.

Report the changes, comparison conditions, before-and-after measurements, correctness checks, and remaining limitations. Mark values that cannot be measured as unmeasured.

4. Prepare unchanged parts in advance to reduce work after arrival

Suppose every price update causes the application to parse the same fixed ID, derive a fixed address from the same inputs, and allocate working memory. This working memory is also called a buffer. Repeating these three preparations places the time spent preparing unchanged information on the path to each decision.
Preparation whose inputs do not change can be completed before the data arrives and reused. After arrival, the application checks the information that changed for this event, builds the final message to send, and signs that content.
The fixed ID is parsed, the fixed address is derived, and working memory is allocated before data arrives. After arrival, the application checks the current price and other variable information, combines it with the fixed parts, finalizes the content, and signs it.
Move unchanged preparation earlier, while keeping validation of the current content and signing after arrival.
Count what changes for three updates. Preparing three kinds of items for every event takes nine preparation operations. Preparing those three kinds once and reusing them sequentially takes three. Both designs still receive three events, process them one at a time, and produce three outputs.
The upper design performs three kinds of preparation for each of three events, totaling nine operations. The lower design prepares the same three kinds once and reuses them sequentially, totaling three operations. Both designs receive, process, and output three events.
The number of events remains three, while fixed preparation falls from nine operations to three in this example.
This comparison assumes the fixed conditions do not change and the working memory can be reused safely in sequence. Its contents are still updated for the current event each time. If multiple operations run concurrently, use separate regions for each operation or a pool that manages access so they do not overwrite the same memory.
Extend the same example to 1,000 events. Preparing three kinds of items for every event takes 3,000 preparation operations; completing the shared preparation once takes three. Both designs receive 1,000 events, process them one at a time, and produce 1,000 outputs. Keep the preparation count separate from the number of events being processed.
Both designs receive, process, and output 1,000 events. Fixed preparation totals 3,000 operations on the left, where it is repeated for every event, and three on the right, where shared preparation is reused. Each gray square represents one preparation operation; the circle on the right enlarges those same three squares fivefold.
What decreases is repeated fixed preparation. Validation, decisions, signing, and other work remain, so the ratio of these counts is not an application-wide speedup.
Define the conditions under which reuse remains valid. If an input to the fixed-address derivation changes, the address must be recalculated. Prices, quantities, balances, referenced account state, risk limits, and blockhashes must be valid when the decision uses them. If the application maintains continuously updated local state, check its version, freshness, and validity. This does not necessarily require fetching everything again over RPC for every decision.
Solana's getLatestBlockhash returns a blockhash and its lastValidBlockHeight. Distinguish block height from slot when checking expiry.[7] Finalize the message before signing it. If the message is changed after signing, create signatures for the updated content.[19]
To reuse fixed preparation and reduce work after receipt, copy these instructions.
text
Inspect work that repeats the same parsing, address derivation, or memory allocation for each input, and move reusable preparation ahead of receipt.

Read the README, development instructions, dependencies, and receipt → preparation → decision → message construction → signing code. Use the existing language, runtime, and SDK. Identify each preparation's inputs, outputs, owner, and validity period.

1. Save reproducible input without confidential information. Record event and output counts, execution count and duration for each preparation, allocated memory, and receipt-to-decision duration.
2. Identify preparation whose inputs remain unchanged, perform it during initialization or another suitable earlier stage, and reuse its result. Implement reuse keys, invalidation and recomputation when inputs or configuration change, and limits on caches and buffer pools.
3. Update reusable working memory for the current input. For concurrent work, use separate regions or managed loans so that a region is not overwritten or returned while still in use.
4. Validate prices, quantities, balances, account state, risk conditions, and blockhashes according to the decision's requirements. Check version and freshness when using continuously updated local state. For Solana, distinguish block height from slot when using lastValidBlockHeight to check blockhash expiry. Finalize the message before signing, and sign the updated message again if its content changes after signing.
5. Using the same input, compare preparation count and duration, receipt-to-decision p50/p95/p99, CPU and memory, and outputs. Also reproduce changed inputs or configuration, expiry, and concurrent execution to check for reuse of obsolete results and memory conflicts. Do not treat the ratio of preparation counts as the overall speedup. Use a monotonic clock for elapsed time within a host, and state the measurement boundaries.

Carry forward existing approvals, permissions, and development procedures. Do not treat these instructions alone as additional permission to change production, enter paid contracts, or conduct live trades. Do not output private keys, credentials, or customer data.

Report the changes, comparison conditions, before-and-after measurements, correctness checks, and remaining limitations. Mark values that cannot be measured as unmeasured.

5. Do not keep making decisions after missing required updates

Consider two markets for the same asset, with the application calculating the price difference B−A. While disconnected, market A changes from 100 to 105, and the application misses that update. If it receives only B's price of 104 after reconnecting, it calculates 104−100, or +4. Using the updated value for A gives 104−105, or -1. Even the sign changes.
After missing A's change from 100 to 105 and receiving only B's value of 104, the application calculates B−A as +4. Using values with A's update applied at the same comparison point produces -1.
The same calculation changes depending on whether it uses A's old value of 100 or the updated value of 105.
This model shows only a price difference. It excludes fees, execution conditions, and other factors, and does not represent trading profit. The point is that restoring the connection does not necessarily restore all updates needed for a decision.
In this example, pause new trading decisions that use the prices of A and B, then replace A's old value of 100 with the recovered value of 105. Next, verify that the updates needed for the decision have been applied to A and B and that the required ordering and freshness conditions are satisfied. Resume once the necessary checks are complete, and remain paused if they cannot be completed.
Market A's old value of 100 is replaced with 105, then passed with market B's value of 104 into a separate consistency check. Decisions resume if the required checks pass; otherwise, they remain paused.
Separate updating the values from verifying that those values can be used for decisions.
A common recovery mechanism is a snapshot: a collection of state at a particular point. When joining it to a continuous update stream, establish which updates are already included in the snapshot and which subsequent updates should be applied. This avoids applying an included delta twice or losing an update at the boundary. The specific method must follow the guarantees of the chosen API for subscription start, identification, refetching, and replay.
Yellowstone messages include fields such as slot and write_version.[16] Their presence alone should not be taken as a guarantee of a sequence usable across providers or of complete gap detection. Do not convert a slot difference directly into a count of missing updates or seconds of latency. Verify that state has been reconnected according to the guarantees of the selected provider.
Also account for calculations that started before recovery. An operation that began with old state but finishes after recovery could overwrite the new state with its result. One approach is to assign state a generation number across recovery and reject results from an older generation. If using processed state, include rollbacks (where that state is no longer adopted) as a condition for reviewing the state.[6]
To recover valid state before resuming decisions after reconnection, copy these instructions.
text
Prevent this application from resuming trading decisions on stale state merely because its connection has returned. Implement recovery of the required state before decisions resume.

Read the README, development instructions, dependencies, and subscription, initial-fetch, update-application, reconnection, and decision code. Use the existing language, runtime, and SDK. Verify the provider, commitment, update semantics, and actual guarantees for ordering, identification, refetching, and replay.

1. Distinguish connection status, data validity, and permission to resume decisions. If missing required updates or insufficient freshness is established, pause new trading decisions that depend on that state while continuing the necessary reception, updates, and recovery.
2. If using a snapshot, establish which updates it includes and its boundary with the following stream from the provider's guarantees. Prevent double application of deltas, gaps at the boundary, and incorrect application order. Do not fill gaps in those guarantees with assumptions. Do not treat slot or write_version as an unconditional sequence for detecting missing updates.
3. Do not resume merely because values have been fetched. Implement checks for the updates, order, freshness, and consistency required for the affected decisions, and keep those decisions paused while the checks cannot be completed. Use generations or an equivalent mechanism to prevent old calculations or order proposals from being applied or sent if work started before recovery finishes later. When resuming, make fresh decisions from validated state. If using processed state, handle invalidation and recovery after a rollback.
4. With reproducible input that excludes confidential information, reproduce updates missed during disconnection, duplicates, reordered updates, stale data, repeated reconnects, and completion of work from an old generation. Verify that decisions remain paused from connection recovery until validation completes and that validated state matches the expected result.
5. Record recovery time, the number of decision attempts suppressed by invalid state and the duration of the pause, reapplied or excluded updates, normal receipt-to-decision duration, CPU, and memory. Do not silently exclude paused periods or missing updates from the measurements. State the measurement boundaries and what can and cannot be detected. Use a monotonic clock for elapsed time within a host.

Carry forward existing approvals, permissions, and development procedures. Do not treat these instructions alone as additional permission to change production, enter paid contracts, or conduct live trades. Do not output private keys, credentials, or customer data.

Report the changes, comparison conditions, before-and-after measurements, correctness checks, and remaining limitations. Mark values that cannot be measured as unmeasured.

Compare language strengths across six dimensions

Implementing these five designs means deciding who updates data, where memory is allocated, what gets copied, and which operations wait. Fast computation, control over sudden delays, and quick prototyping are different strengths. Compare languages according to the part you want to improve.
Compute speed means finishing processing sooner. Latency control means limiting unexpected waits. Prototyping means getting an idea running sooner. A guide to distinguishing fast execution from fast development.

Compare elapsed time in a published benchmark

These published measurements, dated August 1, 2025, run a five-body calculation for 500,000 steps. Mean elapsed time is the average time from program startup to completion. Startup and code optimization during execution are included; the separate build step is excluded. 1,000 ms equals one second.[27][29]
Relative rates calculated from published mean times for 500,000 n-body steps. With Python set to 1, Rust is about 118, C++ 90, Zig 89, Go 77, TypeScript on Deno 38, and JavaScript on Node.js 38. Mean elapsed times are also shown.
Language / runtimeMean elapsed timeRelative rate (Python = 1)
Rust / rustc 1.88.025.1 ms≈118
C++ / g++ 11.4.033.2 ms≈90
Zig / Zig 0.14.133.3 ms≈89
Go / Go 1.24.538.4 ms≈77
TypeScript / Deno 2.4.377.6 ms≈38
JavaScript / Node.js 24.4.179.1 ms≈38
Python / CPython 3.13.52970.8 ms1
Relative rates use the unrounded mean times, with Python set to 1. For each language/runtime family, we select the lowest published mean among stable implementations whose numerical work uses one thread, without explicit SIMD intrinsics, vector types, or external numerical libraries. Code and optimizations differ; Zig uses ReleaseFast. TypeScript runs as an executable containing Deno/V8, while JavaScript runs on Node.js.[28]
Read close values as comparable results, without turning this one task into an overall language ranking. It does not directly measure processing time in a bot that keeps running after startup, or the delay before an order reaches its destination.
The reported environment is Linux on an AMD EPYC 7763 with four available cores. The published measurement code is configured for three repetitions per condition, starting a new process each time. The historical run’s exact commit and raw observations could not be verified, so these are presented as published means.[28][29]

Compare design strengths across six dimensions

The following figures are three-level editorial selection guides for an off-chain Solana client. The Compute speed dimension considers options for accelerating data-intensive reads and computation written directly in the language and implementation being compared. It does not rank whole applications dominated by network waits or computation delegated to accelerated external libraries.
Rust, Go, C++, and Zig are strong candidates for optimized native execution. This does not claim equal speed; a more precise order requires measuring the actual workload. V8 also turns frequently executed functions into machine code. Describing JavaScript as slow simply because it is interpreted would be inaccurate.[20][21]
Three dimensions, Compute speed, Latency control, and Memory control, describe computation and control. Safety support, Prototyping ease, and Solana SDK describe support for development. The six axes do not all represent processing speed.
Every hexagon uses the same axes and scale. Farther outward indicates a stronger qualitative position on that dimension. These are not measured speeds or ratios: a level of 3 does not mean three times a level of 1. Compare the individual dimensions you want to improve, rather than treating polygon area as an overall score.
DimensionWhat it compares
Compute speedOptions for accelerating custom data-intensive reads and computation within the implementation being compared
Latency controlHow directly work such as memory allocation, reclamation, and runtime code optimization can be kept out of important processing to limit sudden delays
Memory controlHow directly you can design data layout, ownership and lifetime, allocation, reuse, and reclamation
Safety supportHelp from language features, runtimes, and standard tools in preventing memory-lifetime and shared-memory errors
Prototyping easeEase of running and iterating on a small application; an editorial judgment that varies with experience and existing code
Solana SDKHow easily official Solana documentation leads to client SDKs and examples for the intended use
The control dimensions assess direct design options, safety assesses available support, and the SDK dimension assesses the route from official documentation. The same level can represent different mechanisms and guarantees.[8][13][20][21][26]
The overview compares six languages in three columns and two rows: Rust, Go, TypeScript, Python, C++, and Zig. Compare the dimensions that matter to you, then use the individual figures and explanations below to check runtime assumptions and suitable uses.
Rust, Go, TypeScript, Python, C++, and Zig in a landscape comparison with three columns and two rows. The six languages use the same six axes and three qualitative selection levels.
Rust's qualitative profile: outer levels for compute speed, latency control, memory control, safety support, and Solana SDK; middle level for prototyping ease. Not measured performance.
Rust combines control over layout, allocation, and reuse on important paths with ownership and borrowing checks. Its ordinary memory management does not require tracing GC.[8] Safe Rust's guarantees against data races do not guarantee freedom from general race conditions, deadlocks, or incorrect decision logic. Unsafe code and foreign-language interfaces require separate verification.[22] Copying, allocation, deallocation, locking, and OS waits still occur, so test actual inputs and load.
Go's qualitative profile: outer levels for compute speed and prototyping ease; middle levels for latency control, memory control, safety support, and Solana SDK. Not measured performance.
Go is also a candidate for native compiled execution. It helps assemble concurrent services and processing while its runtime supports memory management and other operations.[20] Most GC work proceeds concurrently, but measure allocation and the CPU, memory, and latency costs of collection. Its potential for CPU processing is a separate consideration from direct control over reclamation timing.[13]
TypeScript on Node.js and Deno: outer levels for prototyping ease and Solana SDK, middle levels for compute speed and safety support, and inner levels for latency and memory control. Not measured performance.
TypeScript is a language; Node.js and Deno are runtimes. This figure considers JavaScript executed by V8. Type annotations are erased at runtime, so adding types does not itself accelerate CPU work. External data still needs runtime validation.[9][10][21] These options can handle API integration, configuration, monitoring, Web UIs, and stream processing that meets the required performance.
Node.js worker_threads and Deno Web Workers can move CPU work to a different execution context. Node.js documentation recommends a worker pool over creating a worker for each task. Include conversion, copying, and the wait to submit work, as well as computation at the destination.[11][12]
Python code inside ordinary CPython: outer level for prototyping ease, middle levels for safety support and Solana SDK, and inner levels for compute speed, latency control, and memory control. This does not rate computation inside native extensions.
Python is a candidate for research, analysis, validation, and work using existing libraries. The Compute speed rating here concerns loops written in Python and executed inside ordinary CPython. Computation delegated to compiled code, such as NumPy operations, is a different case.[23] Check the actual configuration, including free-threaded builds, rather than deciding from the language name alone.[14] If moving one part to Rust or another implementation, measure conversion and copying at the boundary and verify the whole application benefits.
C++'s qualitative profile: outer levels for compute speed, latency control, and memory control; middle levels for safety support and prototyping ease; inner level for Solana SDK. Not measured performance.
C++ combines low-level control with abstractions and existing libraries. RAII and smart pointers help manage resource lifetimes, but their use does not guarantee all memory-lifetime or shared-memory safety.[24] Its middle safety level also does not imply the same guarantees as managed memory in options such as Go.
Zig in ReleaseSafe: outer levels for compute speed, latency control, and memory control; middle levels for safety support and prototyping ease; inner level for Solana SDK. Not measured performance.
Zig supports explicitly structuring allocation and allocator choice. This profile assumes ReleaseSafe checks. ReleaseFast and ReleaseSmall have different default checks, and ReleaseSafe does not detect every instance of invalid behavior.[25] Sharing a polygon shape with C++ does not imply identical mechanisms.
The Solana SDK dimension uses the official documentation paths for TypeScript and Rust, and the Go and Python clients listed there. It does not rank general library count or quality, or claim C++ and Zig lack libraries. Check required APIs, maintenance alignment, and compatibility with the chosen runtime, including Deno, for the actual SDK.[26]
Measure where your application spends time, then select the strengths that part needs. Reduce waiting and repeated work in the current language first. If finer control is needed, moving the relevant portion to another language remains an option.

Compare changes under the same conditions

Each section's instructions cover implementing and validating its improvement. If applying several improvements, keep each change associated with its measurement results. Applying changes together makes it harder to distinguish which change affected which result.
Compare before and after using the same inputs, subscription conditions, load, and output requirements. For the time from receipt to decision completion, examine the median, p50, along with p95 and p99. The p99 is a threshold within which 99% of measured events finish. It helps reveal the slower side of the distribution as well as typical processing.
Adding the p99 of each stage does not produce the end-to-end p99. Measure the full duration from receipt to decision completion for each event directly, alongside queue waits, CPU and memory use, missing or discarded updates, and agreement between decision results.
When measuring elapsed time within a single host, use a monotonic clock that does not move backward when wall-clock time is corrected. If an SDK invokes a callback only after decoding, processing has also occurred before the callback starts. State exactly where each measurement begins and ends so that delivery latency and application latency can be considered separately.
Check what happens after submission as well. A successful sendTransaction response does not guarantee processing or confirmation by the cluster.[15] Correlating receipt, decision, submission acceptance, and the observed on-chain result helps identify the next place to improve.

Turn fast delivery into timely decisions

Fast delivery and an application that completes the required decisions in time both matter. ERPC continues to improve its delivery infrastructure and develop information that helps improve the software running on it.
First validate application changes in the same environment. Then, where needed, compare the same code across different placements or resources to distinguish their effects. When using ERPC's hourly billing, define the hypothesis, comparison conditions, and usage duration in advance, and check the current Dashboard for pricing and availability.