golang: Switch to fasthttp by default
Standard net/http is known to be putting more focus on idiomaticy instead of performance. Use github.com/valyala/fasthttp whose main focus is performance. It is still all pure go, but it is different Go code.
On my laptop the result for / is:
(-fast=0):
kirr@deco:~/src/tools/net/wrk$ ./wrk -t 4 -c 40 -d 20 http://127.0.0.1:8080
Running 20s test @ http://127.0.0.1:8080
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.02ms 2.58ms 63.90ms 93.04%
Req/Sec 27.33k 3.98k 39.64k 68.38%
2184698 requests in 20.09s, 270.85MB read
Requests/sec: 108752.84
Transfer/sec: 13.48MB
(-fast=1):
kirr@deco:~/src/tools/net/wrk$ ./wrk -t 4 -c 40 -d 20 http://127.0.0.1:8080
Running 20s test @ http://127.0.0.1:8080
4 threads and 40 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 284.88us 645.44us 20.31ms 96.55%
Req/Sec 48.97k 4.16k 71.85k 76.75%
3900962 requests in 20.02s, 550.60MB read
Requests/sec: 194809.91
Transfer/sec: 27.50MB
i.e. it is ~ 1.8x improvement.
I tested this only briefly and had not looked in detail what improvements could also be there.