Wednesday, November 15, 2023

web servers: Go vs Node.js vs Bun vs Nim

node.js is "written" in C++; apparently that is not easy to maintain

node creator then created Deno, in Rust language. It is faster?

Go language is written in Go (after bootstrap). Clever. And it is fast. Faster than node.js

Bun.js is optimized for performance, and written in new-ish language Zig, much simpler than C++

And now there is apparently one more contender, "Nim" language, 
making even faster web servers... 

A "brave new world" of new programming languages! Good!

Web server ‘hello world’ benchmark : Go vs Node.js vs Nim vs Bun – Daniel Lemire's blog

result indicates that Nim is doing quite well on this toy example.

systemrequests/second (10 connections)requests/second (1000 connections)
Nim 2.0 and httpbeast315,000 +/- 18,000350,000 +/- 60,000
GCC12 (C++) + lithium190,000 +/- 60,000385,000 +/- 80,000
Go 1.1995,000 +/- 30,000250,000 +/- 45,000
Node.js 20 and uWebSockets.js100,000 +/- 25,000100,000 +/- 35,000
Bun 1.0480,000 +/- 15,00065,000 +/- 20,000
Node.js 20 (JavaScript)45,000 +/- 7,00041,000 +/- 10,000
Bun + fastify40,000 +/- 6,00035,000 +/- 9,000

*Jarred Sumner, the author of Bun, said on X that fastify is not fast in bun right now but that Bun.serve() is more than twice faster than node:http in bun.

Go and Node.js Comparison: Scalability, Performance, Tools

oven-sh/bun: Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one

what is Nim?

Nim Programming Language

Nim is a statically typed compiled systems programming language.

It combines successful concepts from mature languages like Python, Ada and Modula.

No comments: