WebSocket servers in JavaScript: Node.js, Bun and Deno in 2026

Daniel Lemire · 2026年10月10日

AI 摘要 AI 生成,可能有误

The author re-ran a corrected WebSocket ping-pong benchmark in 2026 comparing JavaScript servers on Node.js 26, Bun 1.4.2, and Deno 2.9.7, using a fast C client to fix the slow JavaScript clients that skewed earlier results. Node.js with uWebSockets.js proved fastest at 49,000 round trips per second (approaching a simple C relay at 54,000), ahead of Deno's built-in server at 40,000 and Bun's at 37,000. A second test with the ws package on all three runtimes confirmed the same ranking, with Node.js first, Bun second, and Deno last.

WebSocket is a standard protocol to hook up a client and a server in a persistent manner. It is commonly used for live chat, notifications, multiplayer games, collaborative editing, and streaming dashboards. Many servers are written in JavaScript and use Node.js, Bun or Deno as an engine.

A few years ago, I wrote a simple WebSocket benchmark in JavaScript. Two clients exchange messages through a server: client 1 sends a message to the server, the server forwards it to client 2, client 2 answers, and the server forwards the answer back to client 1. I found that Bun could be twice as fast as Node.js. That result was wrong. The Bun server sent each message back to the sender, so a round trip was two messages instead of four. Since then, Anthropic bought Bun. Also, Cloudflare bought Deno.

My benchmark had an issue: my clients were written in JavaScript, and they were slow. So I wrote a client in C. Doing so by hand in 2023 was expensive, but in 2026, my AI friends can write anything in C.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Daniel Lemire

Writing a paper is no longer a signal

AI 摘要A journal editor argues that AI agents can now generate entire research papers—with plots, tables, and discussion—so easily that writing a paper, even a serious-looking one or a PhD thesis, no longer signals high ability and will lose its prestige. The author contends that academic publishing has already been irreversibly disrupted, even if societal norms take time to adjust. Academics should therefore focus on solving actual problems, since while writing about curing cancer is now trivial, curing cancer itself remains a genuine challenge.

Our textbook on machine learning and artificial intelligence is out

AI 摘要Robert Godin and the author have released a new 741-page textbook, 'Introduction to Machine Learning and Artificial Intelligence with Python,' available in paperback and Kindle editions. The book is aimed at college students taking a first course or Python programmers wanting to learn machine learning, covering NumPy, Pandas, linear regression, decision trees, building a neural network from scratch, and then moving to PyTorch, transformers, model libraries, language models, reinforcement learning, and deploying a model in a container. Each chapter includes runnable examples and exercises with solutions.

Don’t be Andy Bernard

AI 摘要The article argues that prestige—reputation by association with elite institutions or signals—is not the same as genuine reputation, which is earned slowly through reliable work and can be lost quickly. Prestige is noisy, gamified, and time-delayed, and relying on it too long becomes a negative signal, as illustrated by Andy Bernard from The Office constantly touting his Cornell degree. The author's advice is to skip the shortcuts and build real reputation by doing good work.

Command-line JSON filtering at 20 GB/s

AI 摘要sjq is a new command-line tool that implements the jq filter language on top of the simdjson parser, filtering NDJSON at 3.5 GB/s on a single thread (about 37 times faster than jq) and up to 20 GB/s with multiple threads. It is highly compatible with jq, passing 728 of jq's 781 tests and supporting most of its features, while adding extras like the --fractured option for readable, table-like JSON output. sjq can be installed on Linux, macOS, and Windows via an install script, Homebrew, or Scoop.

Cheaters are Innovators

AI 摘要The article argues that true innovation comes from those willing to bypass or 'cheat' rigid systems rather than seeking approval within them. Instead of convincing established institutions to change, innovators build alternatives—like starting their own platforms or founding companies such as SpaceX—that render the old system unnecessary. The author encourages readers to test ideas independently and find ways to work around existing rules rather than waiting for permission.