OK, where were we and why we are here?
Quoting from my blog that started all these:
Back in my mind, I had always thought that Perl is slow, comparing to compiled languages, like C/C++. So it is always in my mind that I should rewrite my simple web server from Perl to a compiled language. Finally I did...
The Go community was not very happy about it, and neither do I, as a matter of fact, because I do believe that Go should be faster than Perl. Many people have given good & valid inputs as where things might get
improved, and I did try out everyone's suggestion to see how things can improve, including avoiding regular expressions, or using the high performance web framework echo (including echo v4), but all are just marginally faster, or have no obvious benefit at all, in which case I didn't even log a version.
That was quite some hectic journey, but long story short, I finally made it, with helps I got from various sources -- I finally made Go faster than Perl!!!
And here are the test results from my machine (which I published here):
100 concurrency requests (the number of multiple requests to perform at a time):
From this we can see Go is on-par with Perl for the ballpack of the results. OK, then why I said Go is now faster than Perl?
Take a look at the Apache Bench's statistics first:
I.e., for the Requests per second (#/sec), Perl is
4450.18 while Go is
11675.42. That's 2.6 times of Perl's throughput, while not sacrificing individual's response time much.
Moreover, when the load is light (< 70), which is the most common situation for my specific case, Go is faster than Perl.
So I'm quite happy with the result now.