Skip to content

Instantly share code, notes, and snippets.

@corporatepiyush
Created June 11, 2026 09:06
Show Gist options
  • Select an option

  • Save corporatepiyush/a0ef453de373ee1553de7d5bc998f4d3 to your computer and use it in GitHub Desktop.

Select an option

Save corporatepiyush/a0ef453de373ee1553de7d5bc998f4d3 to your computer and use it in GitHub Desktop.
Programming language comparison
Aspect Odin (dev-2026-05) Zig (0.16.0) Rust (1.95+) Go (1.26+) heavy unsafe Java (25 LTS) C# (.NET 11 preview / C# 15)
Build / Compilation Model Package = directory. Full visibility inside one package. -use-single-module + Thin LTO for unity-build optimized mode. Whole-program visibility via comptime. Strong incremental (-fincremental) now a first-class feature since 0.16. Crate barriers. lto=fat + codegen-units=1 + PGO for near-monolithic. Package-based; whole-program optimizations via the linker. Fast by design. JVM JIT + GraalVM Native Image (AOT). Strong whole-program analysis in native mode. .NET JIT + Native AOT. Excellent whole-program opts with Native AOT.
Package Handling & Cost Low inside package. Cross-package: minor loss unless single-module + LTO. Vendoring via collections. Improved in 0.16: local zig-pkg directory, global compressed cache, --fork flag for debugging. Low cross-module overhead via whole-program + comptime. High for hot paths. Vendoring possible but ceremony-heavy. Very low. go mod simple. Modules + JARs. Some overhead; Graal Native mitigates. NuGet. Reflection/dependency costs possible in hot paths.
Inbuilt Data Structures Slices, maps, bit_sets, matrices, #soa structs, tagged/untagged unions, distinct types. Strong data-oriented. Arrays, slices, structs, unions. Maps via std.HashMap / std.AutoHashMap / std.StringHashMap (no map-literal syntax). Vec, HashMap, rich enums (data-carrying), arrays. Slices, maps (built-in syntax), channels, arrays. No sum types. Rich Collections, records, arrays, List, Map. List, Dictionary, Span, records, arrays.
Pointer Operations Raw pointers, multi-pointers, arithmetic, #align, #raw_union. Ergonomic. ptrCast, alignCast, bitCast, arithmetic. Predictable. unsafe: NonNull, strict provenance rules (stabilized in 1.84). unsafe.Pointer + uintptr arithmetic. Limited (FFM API finalized in JDK 22 + Unsafe). unsafe, Span, ref structs, pointers.
Type Magic Tagged unions, raw unions, #soa, distinct types, parametric, reflection. comptime arbitrary codegen, anytype, packed structs. Generics, const generics (expanding), data enums. Edition 2024 stable (1.85). Interface forging, reflection. Self-referential generics since 1.26. Records, sealed classes, pattern matching, generics. Records, type unions (C# 15 union keyword — compose existing types), spans.
Tagged Pointers / Thin Pointers Natural: bit ops + tagged/raw unions. Clean. Extremely powerful via comptime. Possible with unsafe + packing. Cross-crate friction. Heavy unsafe.Pointer + interface forging. Fragile. Possible via FFM/Unsafe but dirty & GC-limited. Strong with Span + unsafe. Predictable.
Dispatch / Devirtualization Tagged unions -> jump tables. Manual tables trivial. Best: comptime specialized tables. Enums zero-cost inside crate. dyn Trait costly unless tuned. Always dynamic dispatch. Interface forging possible. Virtual calls. JIT + PGO devirtualizes well. Virtual calls. Strong JIT + PGO.
IO Mechanics core:nbio — non-blocking callbacks over IOCP/io_uring/kQueue. Io.Threaded (stable, default). Io.Evented (fibers/green threads via userspace stack switching — experimental). Io.Uring (PoC only). No function coloring regardless of backend. Tokio etc. async/await + executor. Async closures stable since 1.85. Netpoller + goroutines. Simple API. NIO + Virtual Threads (mature since JDK 21, pinning fixed in JDK 24). Write blocking-style code. async/await + ValueTask, I/O pipelines. Runtime Async (.NET 11 preview): moves state machines from compiler to runtime — lower overhead, cleaner stack traces, Native AOT compatible.
Concurrency Model OS threads, mutexes, channels. Explicit. Callbacks/coroutines on nbio. Threads + Io.Evented fibers (experimental M:N). No function coloring. Send/Sync + Tokio tasks. Goroutines (M:N) + channels. Green Tea GC default in 1.26. Virtual Threads (stable) + Scoped Values (finalized JDK 25, JEP 506) + Structured Concurrency (still preview, JEP 505 — 5th preview in JDK 25). Tasks + async/await, channels, ThreadPool. Runtime Async in preview.
Cost of IO/Concurrency Abstractions Low: explicit, thin layer. Minimal hidden cost. Very low for Io.Threaded. Io.Evented fibers promising but experimental — overhead not yet settled. Medium: runtime overhead, pinning, executor machinery. Tunable. Low-medium: cheap goroutines, Green Tea GC reduces GC tax on small-alloc-heavy workloads. Very low: Virtual Threads heap-allocated, start at ~200-400 bytes, grow dynamically. Excellent scalability for I/O-bound work. Low-medium: Runtime Async reduces state-machine overhead and removes heap-hoisted locals in common cases.
Low-Level Control + Dirty Tricks High & ergonomic. Raw layout, SOA, toggle bounds checks. Highest + predictable. comptime enables powerful metaprogramming and layout control. Powerful unsafe but borrow friction. Strict provenance improves soundness. Extreme: interface forging, uintptr hacks. High risk and fragile across GC versions. Medium: FFM API + Unsafe + JNI. GC limits determinism. High in unsafe + Native AOT. Predictable.
Optimization Philosophy Pragmatic. Single-module + Thin LTO. Aggressive + predictable via whole-program visibility + comptime. LLVM + LTO/PGO heavy. Edition 2024 tightens unsafe semantics. Conservative + GC. Green Tea GC (default in 1.26) improves cache behavior on modern CPUs. Unsafe bypasses available. JIT (long-running) + Graal AOT. Strong PGO. Tiered JIT + Native AOT + PGO. Runtime Async reduces async overhead.
Compile Times Fast dev. Optimized single-module slower. Very fast incremental (-fincremental + --watch). Full builds slower. Per-crate incremental good. Fat LTO slow. lld default on x86_64 Linux since 1.90 cuts link times. Blazing fast. Green Tea GC adds no compile overhead. Slow javac, fast JIT warmup. Graal AOT slow. Fast. Native AOT slower.
Ergonomics / Sugar High joy: or_return, context system, clean syntax. Explicit but powerful. No hidden costs. High complexity. Async closures (1.85), let chains (1.88) improve ergonomics. Simplest syntax. new(expr) in 1.26 reduces pointer-field boilerplate. Very high (records, patterns, virtual threads, compact source files/instance main in JDK 25). Very high (records, async, type unions in C# 15).
Safety / Predictability Good defaults. No borrow checker. Explicit, no hidden costs. No borrow checker. Strongest outside unsafe. Edition 2024 tightens unsafe extern and provenance rules. GC + runtime. Unsafe risky and fragile. GC + strong runtime checks. GC + strong type system. Native AOT removes reflection surprises.
Dirty Tricks Power & Risk Strong low-level with clean syntax. Highest power + predictability. Powerful but verbose. Provenance rules add friction. Extremely flexible but fragile (GC/version breaks). High via Unsafe/FFM but GC-constrained. Strong via unsafe + Native AOT. Predictable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment