Why we rewrite Everything in Rust.
Memory safety is table stakes for financial infrastructure. A deep dive into the performance gains of our new transaction engine.
When you're building financial infrastructure, "fast enough" is never enough. Every millisecond matters. Every memory leak is a potential catastrophe. We started WRKSHP's core infrastructure in TypeScript. It was fast to build, easy to iterate, and worked fine for prototypes. But as we scaled, cracks appeared.
The Problem with "Fast Enough"
"In financial infrastructure, the difference between 145ms and 12ms isn't optimization—it's survival."
We needed to make a decision: keep patching TypeScript, or invest in a complete rewrite.
The Numbers Don't Lie
After migrating our transaction processing engine to Rust:
| Metric | TypeScript | Rust | Improvement | |--------|-----------|------|-------------| | Latency (p99) | 145ms | 12ms | 12x faster | | Memory usage | 2.4GB | 180MB | 13x smaller | | Throughput | 8k req/s | 50k req/s | 6x higher |
Why Rust?
Memory Safety Without Garbage Collection — Rust's ownership model eliminates entire classes of bugs—null pointer dereferences, buffer overflows, use-after-free—at compile time. No garbage collector means predictable latency.
Zero-Cost Abstractions — Write high-level code, get low-level performance. Rust's compiler optimizes aggressively while maintaining safety guarantees.
Fearless Concurrency — The borrow checker ensures thread safety at compile time. No data races, no deadlocks, no 3am pages.
The Migration Strategy
We didn't rewrite everything at once. Our approach:
- Identify hot paths - Profile production traffic
- Isolate components - Extract into separate services
- Rewrite incrementally - One service at a time
- Validate extensively - Shadow traffic before cutover
What We Learned
- FFI is your friend - Call Rust from Node.js for gradual migration
- Tokio is incredible - Async Rust is production-ready
- Compile times hurt - But incremental compilation helps
- The type system catches bugs - That we didn't know we had
The Future
Every new service at WRKSHP starts in Rust. Our Solana programs, our transaction engine, our security layer—all Rust.
The upfront investment pays dividends in reliability, performance, and developer confidence.
Questions about our architecture? Reach out at eng@wrkshp.dev
Forward-Looking Statements: This memo may contain forward-looking statements regarding future events, market projections, and business prospects. Such statements are based on current expectations and are subject to risks and uncertainties that could cause actual results to differ materially. Past performance is not indicative of future results. This content is for informational purposes only and does not constitute investment advice.