Files
node/lib
Matteo Collina 086741d121 timers: reuse Timeout objects in setStreamTimeout
Rearm the stream's existing Timeout object instead of allocating a new
Timeout and a bound callback on every setTimeout() call. The HTTP
server disarms and rearms the keep-alive timeout twice per request, so
this saves two allocations and the associated async resource churn on
every request over a keep-alive connection.

The async resource is re-initialized on reuse, so async_hooks observes
the same init/destroy sequence as before.

A microbenchmark of the setTimeout(msecs)/setTimeout(0) cycle improves
by 2.2x (205.9ns to 92.8ns), and benchmark/http/simple.js
(type=buffer len=1024 chunks=1 chunkedEnc=0 c=50) improves by 3.70%
(t=2.15, 40 samples per binary with server and load generator pinned
to disjoint CPU sets).

Assisted-by: Claude Fable 5 (Claude Code)
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/64254
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2026-07-06 16:33:27 +00:00
..
…
…
…
2026-07-06 10:03:33 +02:00
…
2026-05-05 16:19:18 +02:00
2024-01-12 16:09:48 +00:00
2025-12-10 16:12:28 +00:00
2025-12-22 16:14:46 +00:00
2024-10-09 06:42:16 +00:00
2025-09-04 11:58:50 +00:00
2026-02-21 16:30:23 +00:00
2026-05-05 16:19:15 +02:00
2026-06-20 16:58:12 +02:00
2026-05-05 16:19:39 +02:00
2026-06-20 17:50:48 +02:00
2025-08-05 13:45:41 +00:00