Performance comparison (benchmark) between C# (ASP.Core), PHP (Lumen) and Golang

Performance comparison (benchmark) between C# (ASP.Core), PHP (Lumen) and Golang

Performance comparison (benchmark) between C# (ASP.Core), PHP (Lumen) and Golang

I have been programming my applications with C# and the .Net Framework for a long time. I originally come from desktop development and learned to run with WinForms and C#. The language, your syntax and your language features have always impressed me and I had no reason to use another programming language as the primary language. Even if I have always strayed a little and other languages ​​such as Python, PHP, JavaScript, Object Pascal u.v.m. I have always come back to C#. However, since I have been doing more and more backend development (Web APIs) in the front end of a web application (VueJS or Angular), I have recently asked whether the .Net Framework or ASP.Core is still the right one for me. With the last announcement, Microsoft also decided that .Net Core (The Savior who was praised 2 years ago) will now be combined with the .Net Framework and .Net Standard as well as Xamarin and a .Net 5 appears. As good as the decision may be, the impact for us developers is also violent. There will be countless breaking changes again, what will happen to my old projects? What do I have to migrate? Do I have to learn new language features again? Please don’t get me wrong, I’m eager to learn. But as a developer, I don’t want to have to learn a new framework every two years. I want my code to run for years and not become obsolete once it’s written. So I recently started looking around the programming language market and looked at some frameworks and concepts. I was already familiar with Lumen and PHP because I had already implemented various projects with it, but the performance was always a bitter aftertaste, at least if you come from .Net Core. But how does the performance actually compare to other languages? For this reason, I simply created a simple performance comparison (benchmark) between ASP.Core Web API, Go lang and PHP with Lumen.

Programming language benchmark

To find out how the languages behave differently, I created a benchmark with the three languages that are of interest to me. Go lang, ASP.Core and PHP with the Microframework Lumen. I gave all three languages the same task and then sent 10,000 requests with the Apache Benchmark Tool to see which framework or which language did the task the fastest. The application is a web API that provides simple arithmetic problems and returns the result. I deliberately avoided writing operations and databases - my only concern was the export time of code.

Golang performance

In my opinion, Golang is currently the most interesting programming language when it comes to backend development. On the one hand Go is comparatively fast like C ++, but offers modern language features like asynchronous programming (simply implemented) as well as access to a huge library selection for SSL, ORM, Protobuff and more. Speak the performance of C++, but with modern language features.

C:\xampp\apache\bin\ab.exe -n 10000 -c 10 -k -H "Accept-Encoding: gzip, deflate" "http://localhost:10000/" > go.log
package main

import (

func homePage(w http.ResponseWriter, r *http.Request){
    next := 1
    for a := 1; a < 1000; a++ {
        next = next + (a * a)
    fmt.Fprintf(w, "Welcome to the HomePage! - Result: %d", next)

func handleRequests() {
    http.HandleFunc("/", homePage)
    log.Fatal(http.ListenAndServe(":10000", nil))

func main() {

PHP (Lumen) performance

C:\xampp\apache\bin\ab.exe -n 10000 -c 10 -k -H "Accept-Encoding: gzip, deflate" "http://localhost/testapi/public/" > lumen.log
namespace App\Http\Controllers;

use Laravel\Lumen\Routing\Controller as BaseController;

class Controller extends BaseController
    public function index() {
        $next = 1;
        for ($a = 1; $a < 1000; $a++) {
            $next = $next + ($a * $a);

        $result = $next;
        return response("Welcome to the HomePage! - Result: ".$result);

C# performance (ASP.Core)

C:\xampp\apache\bin\ab.exe -n 10000 -c 10 -k -H "Accept-Encoding: gzip, deflate" "http://localhost:59380/Default" > dotnetcore.log
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace testapi.Controllers
    public class DefaultController : ControllerBase
        public DefaultController() { }

        public String Get()
            int next = 1;
            for (int a = 1; a < 1000; a++)
                next = next + (a * a);
            return "Welcome to the HomePage! - Result: " + next;

The benchmark result

Metrik ASP.Core API Lumen Go
Time taken for tests 3.461 sec 41.776 sec. 1.391 sec.
Complete requests 10000 10000 10000
Failed requests 0 0 0
Keep-Alive requests 5655 0 10000
Requests per second 2889.22 [#/sec] 239.37 [#/sec] 7187.71 [#/sec]
Time per request 3.461 ms 41.776 ms 1.391 ms

As you can see, lumen is about 40 times slower than Go. Go is even 3 times faster than C# in this test and has the more compact code of all the other frameworks / languages because it is only one file and does not have tens of thousands of project folders.