With Laravel Rust and Laravel Go both announced, many of us are wondering whether it's time to learn a compiled language. Here's a practical comparison from the point of view of someone who mostly writes PHP, JavaScript and the odd ESP32 sketch.
The short version
- Go: simple, productive and fast enough for almost any web backend. You can be writing real code within a week or two.
- Rust: as fast as C, memory-safe, and it also runs on microcontrollers. It's much harder to learn, but it rewards the effort.
Learning curve
Go is a small language. You can read the whole spec in an afternoon, and most Go code looks alike no matter who wrote it.
Rust has ownership, borrowing and lifetimes. Expect to fight the compiler for the first few weeks. Once it clicks, the compiler becomes the best code reviewer you've ever had.
Performance
Both are far faster than PHP.
- Rust has no garbage collector, so latency is predictable and memory use is minimal.
- Go's garbage collector is very good, but you'll notice it under heavy load or with tight memory budgets.
- For a typical web app, your database will be the bottleneck long before either language is.
Concurrency
- Go: goroutines and channels are built in and very easy to use. This is Go's strongest point.
- Rust: async/await with Tokio is powerful and safe; the compiler stops data races before they happen. It's harder to get right, though.
Tooling and deployment
Both compile to a single binary, so you copy one file to the server and you're done.
- Go: compiles almost instantly.
- Rust: compiles slowly, but
cargois excellent for builds, tests, docs and dependencies.
Embedded / ESP32
This is where they clearly part ways:
- Rust has solid ESP32 support through
esp-rs, both with the standard library and bare-metal. - Go mostly relies on TinyGo, which works but is limited.
If you also build hardware projects, that alone can decide it.
Ecosystem
- Go: strong in cloud and DevOps (Docker, Kubernetes and Terraform are all written in Go), APIs and CLI tools.
- Rust: strong in systems programming, CLI tools, WebAssembly, embedded and anywhere performance matters.
Not ready to switch? Try FrankenPHP
If you love PHP but want more speed, there's a third option: FrankenPHP, a modern PHP app server written in Go and built on the Caddy web server.
- Worker mode keeps your app in memory between requests instead of booting it every time like PHP-FPM, which typically makes it 2–4× faster.
- HTTP/2, HTTP/3 and automatic HTTPS come built in.
- Deployment: it can bundle your app into a single binary, just like Go.
- Catch: your code must be safe to keep in memory between requests (no state left over from one request to the next), and raw speed and memory use still trail Go and Rust.
For many PHP sites this closes most of the gap without rewriting a single line in another language.
So which one?
- Pick Go if you want to build web services and APIs quickly, work in a team, or move away from PHP with the least effort.
- Pick Rust if you care about maximum performance, want one language for both servers and microcontrollers, or simply enjoy a challenge.
- Stick with PHP (plus FrankenPHP) if your site is already fast enough, or you just need a speed boost. A tuned PHP app is still plenty for most forums and shops.
My own pick: Rust, because it covers both web and ESP32 work. If I only did web backends, I'd choose Go without a second thought.
What are you using, or planning to learn? Share your experience below.
Advertise your mobile site for FREE with AdTwirl