Benchmark 2025: C# (.NET) vs Competitors — Who Holds the Lead?
In 2025, choosing a programming language often comes down to a trade-off between development speed and execution performance. We analyzed the latest benchmarks and compared C# (.NET 9) with its main competitors: Python (3.13), Java (21 LTS), and Go (1.23). The results were surprising even for experienced developers.
How Did We Test?
For the sake of a clean experiment, we used standard synthetic tests (sorting algorithms, JSON processing, database operations) and real-world scenarios: a REST API server, image processing, and parallel computing. Three key metrics were measured:
- Execution time (in milliseconds)
- Memory consumption (in MB)
- Startup speed (cold start)
Results: C# (AOT) vs Everyone
The main surprise is the Native AOT mode (Ahead-of-Time compilation), which Microsoft is actively developing. In tests on computations without memory allocation, C# on AOT outperformed Java by 15% and Go by 8%. However, in scenarios with intensive object allocation (e.g., JSON parsing), Go came out ahead due to its optimized garbage collector.
- Python — the slowest (20-40 times slower than C# in pure computations), but the leader in code writing speed and flexibility.
- Java — close to C# (5-10% difference), but loses in startup speed due to the JVM.
- Go — the fastest in network tasks and microservices, but lags behind C# in complex multi-threaded computations.
- C# (.NET) — a universal soldier: excellent performance, low memory consumption (thanks to Span
and Memory ), and the best ecosystem for Windows projects.
What to Choose in 2025?
Our verdict: C# (.NET) is the best choice for enterprise applications, games (Unity), and high-load web services where performance on Windows is critical. Python remains the king of prototyping and ML. Java is for legacy projects and Android. Go is for cloud microservices and command-line tools.
Full benchmark tables and test code are available on our GitHub. Stay tuned for updates — in the next issue, we will analyze Rust and C++!