fn main() {
let s = String::from("hello");
let s2 = s;
// s is moved
println!("{}", s2);
}
struct Point { x: f64, y: f64 }
impl Point {
fn dist(&self) -> f64 {
(self.x*self.x
+ self.y*self.y).sqrt()
}
}
2–12× faster than Go on CPU-bound tasks. No GC pauses means predictable tail latency — critical for trading systems, game engines, and high-throughput services. The borrow checker is a steep climb, but once you're over it, entire classes of bugs disappear at compile time.
Performance
Systems
WebAssembly
Embedded
Best when: latency, safety, or raw throughput is non-negotiable
import asyncio
from dataclasses import dataclass
@dataclass
class Model:
name: str
layers: int
async def train(m: Model):
await asyncio.sleep(0)
return f"{m.name} trained"
model = Model("gpt", 96)
result = asyncio.run(train(model))
60–100× slower than Go on CPU work, yet 80% of ML projects choose Python. PyTorch, TensorFlow, Pandas — the ecosystem is unmatched for data science. FastAPI and async patterns close the gap for I/O-bound services. If you're building anything AI-adjacent, Python is the default.
AI / ML
Data Science
Scripting
Automation
Best when: machine learning, data pipelines, or fast prototyping
interface User {
id: string
email: string
role: 'admin' | 'viewer'
}
async function getUser(
id: string
): Promise {
const res = await fetch(`/api/${id}`)
return res.json() as Promise
}
If your team already writes TypeScript for the frontend, sharing types and validators across the stack eliminates an entire category of bugs. Go runs 5–40× faster on CPU — but for I/O-bound APIs, the gap narrows to noise. Hono, Fastify, and NestJS make the backend story credible.
Full-stack
APIs
Real-time
NPM ecosystem
Best when: full-stack teams sharing types, or I/O-bound services
@RestController
@RequestMapping("/api")
public class UserController {
@Autowired
private UserService service;
@GetMapping("/users/{id}")
public ResponseEntity
getUser(@PathVariable Long id) {
return ResponseEntity.ok(
service.findById(id));
}
}
The JVM is boring in the best possible way — predictable, profiled, and optimized by 30 years of real-world load. Spring Boot's ecosystem handles auth, observability, and distributed transactions out of the box. Higher memory footprint than Go (~30 MB vs ~2 MB), but JIT closes the raw performance gap over time.
Enterprise
Microservices
Spring
Quarkus
Best when: large existing JVM codebases or regulated enterprise environments
data class User(
val id: Long,
val name: String,
val email: String
)
suspend fun fetchUser(id: Long): User =
withContext(Dispatchers.IO) {
db.users.findById(id)
?: throw NotFoundException(id)
}
val users = (1..100)
.map { fetchUser(it.toLong()) }
Java's syntax drag, removed. Kotlin keeps the ecosystem while adding coroutines, data classes, null-safe types, and a cleaner expression model. The official language for Android. Kotlin Multiplatform lets you share business logic across Android, iOS, and server — a genuine alternative to separate Go backends.
Android
JVM
Multiplatform
Coroutines
Best when: Android-first or modernizing a Java codebase
public record User(
Guid Id, string Email);
[ApiController, Route("[controller]")]
public class UsersController
: ControllerBase {
[HttpGet("{id:guid}")]
public async Task
Get(Guid id) {
var u = await _repo.FindAsync(id);
return u is null
? NotFound() : Ok(u);
}
}
.NET 9's AOT compilation cuts startup from ~60 ms to ~3 ms — competitive with Go for containerized workloads. LINQ, pattern matching, async/await, and record types make C# one of the most ergonomic enterprise languages. Still dominant in gaming (Unity) and Windows-heavy shops.
Enterprise
Gaming
Azure
AOT
Best when: .NET ecosystem, Unity, or Azure-native deployments
#include
#include
template
class RingBuffer {
std::vector buf;
size_t head = 0, tail = 0;
public:
void push(T val) {
buf[head++ % buf.size()] = val;
}
T pop() {
return buf[tail++ % buf.size()];
}
};
When you need every cycle — game engines, HFT systems, graphics pipelines — C++ is still the answer. Modern C++ (17/20/23) is far safer and more expressive than its reputation suggests. Steeper learning curve than Go, slower compilation, but there is no runtime overhead ceiling to hit.
Performance
Game engines
HFT
Embedded
Best when: maximum performance and hardware control are required
const std = @import("std");
pub fn main() !void {
const ally = std.heap
.page_allocator;
const buf = try ally.alloc(u8, 64);
defer ally.free(buf);
const msg = "hello, zig";
@memcpy(buf[0..msg.len], msg);
std.debug.print("{s}\n", .{buf});
}
Zig treats C interop as a first-class feature — you can call C directly, or compile C code with the Zig compiler. No hidden control flow, no macros, no runtime exceptions. Excellent WASM support. The ecosystem is still small, but for bootloaders, embedded firmware, or replacing C glue code, Zig is worth learning.
Systems
C interop
WebAssembly
Embedded
Best when: replacing C, firmware, or WebAssembly targets
defmodule Chat.Room do
use GenServer
def start_link(name) do
GenServer.start_link(
__MODULE__, %{}, name: name)
end
def broadcast(room, msg) do
GenServer.cast(room, {:msg, msg})
end
def handle_cast({:msg, m}, state) do
Phoenix.PubSub.broadcast(
Chat.PubSub, "room", m)
{:noreply, state}
end
end
Built on the Erlang VM, Elixir processes are lightweight (like goroutines) but isolated by design — a crashed process doesn't bring others down. Phoenix LiveView delivers real-time UIs without JavaScript spaghetti. If your system needs to stay up while parts of it fail, Elixir's supervision trees are hard to beat.
Real-time
Fault-tolerant
Phoenix
Distributed
Best when: real-time systems, messaging, or fault-tolerant distributed services
struct Point: Sendable {
let x, y: Double
var magnitude: Double {
(x*x + y*y).squareRoot()
}
}
actor Cache {
private var store = [K: V]()
func get(_ k: K) -> V? { store[k] }
func set(_ k: K, _ v: V) {
store[k] = v
}
}
Swift's actor model and structured concurrency are genuine innovations — close in spirit to goroutines but with stricter compile-time guarantees. Performance rivals C++ in benchmarks. The catch: outside Apple platforms, the tooling story is still maturing. If your users are on macOS/iOS, Swift is the obvious choice over Go.
Apple ecosystem
iOS / macOS
Server-side
Actors
Best when: Apple platforms or teams already in the Xcode ecosystem