Go v1.13.3 vs Node v12.12.0 Microbenchmark

Multithreaded JavaScript has been published with O'Reilly!
DEPRECATED: This post may no longer be relevant or contain industry best-practices.

This is my third annual microbenchmark comparing a very simple Node.js and Go HTTP service running on the local machine. Usual disclaimer: this benchmark is highly contrived and doesn't resemble real-world usage. If you'd like to view the code for the benchmark visit the original benchmark post.

As per usual we run the benchmark using a tool called siege:

siege -t 2m -b http://localhost:8000/

The results are as follows:

Node v12.12.0

Transactions:                 183560 hits
Availability:                 100.00 %
Elapsed time:                 119.78 secs
Data transferred:               2.52 MB
Response time:                  0.01 secs
Transaction rate:            1532.48 trans/sec <--
Throughput:                     0.02 MB/sec
Concurrency:                   14.97
Successful transactions:      183560
Failed transactions:               0
Longest transaction:            0.06
Shortest transaction:           0.00

Go v1.13.3

Transactions:                 491169 hits
Availability:                 100.00 %
Elapsed time:                 119.28 secs
Data transferred:               6.45 MB
Response time:                  0.00 secs
Transaction rate:            4117.78 trans/sec <--
Throughput:                     0.05 MB/sec
Concurrency:                   14.92
Successful transactions:      491169
Failed transactions:               0
Longest transaction:            0.06
Shortest transaction:           0.00

Takeaway

Go is 2.69x as fast as Node.js for this particular benchmark. What's the most interesting to me is that the Node.js results have been the same between v8, v10, and v12. However, Go increased in speed 20% from v1.9 to v1.10, and another 34% from v1.10 to v1.13.

Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript and is an O'Reilly published author.