Is go really faster than PHP/Nodejs?

I just created a sample web api using go and go-chi router.
Go takes almost 100% cpu usage in mac 2017.

I just checked mysqld, which takes 0.1% of CPU, while main(go process) takes 100% of CPU during a single request, then goes down…

Just using the example code from go-chi router.

your post makes not logical or technical sense. you are conflating things that are NOT related. CPU utilization is good if the code is optimized, which Go is. your understand is flawed at best.

TechEmpower Framework Benchmarks gives a reasonable list of benchmarks.
The fastest are C++ and Rust frameworks (e.g. drogon-core).
The fatest Go implementations come in at about 60% of the performance of drogon-core.
And the worst are the Python frameworks - e.g. flask has 1.5% of the performance of drogon-core.

Go is not the fastest language out there - especially if you use the standard library, which parses all the request headers, even if they are not used. But it does hit a sweetspot - decent performance and easy to use.

1 Like

Thanks for sharing. To me, these benchmark show that performance depends more on the library or framework used than the language. Go, JS, and PHP libs/frameworks, for example, are spread across the spectrum of test results, and this clearly shows how much room for optimization exists even within a given language.

And if we only look at languages, I’d say the main differentiator here seems to be manual vs automatic memory management. At the top of the benchmark charts, there are almost always languages with manual memory management.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.