mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
AbortSignal.any() follows its sources as soon as it creates a composite, so aborting a source synchronously aborts every composite that follows it. The aborted and reason getters and throwIfAborted() still walked the composite's sources on every call and dereferenced the WeakRef of each one, which is expensive because WeakRef.prototype.deref() adds its target to the kept objects of the current job. That walk can no longer find an aborted source of a composite that isn't aborted itself, so remove it. throwIfAborted() on a composite with two sources becomes about 17 times faster, the same as on a plain signal. Add a benchmark for throwIfAborted() on plain, timeout, composite and mixed signals. Assisted-by: claude:opus-5.5 Signed-off-by: Robert Nagy <ronagy@icloud.com> PR-URL: https://github.com/nodejs/node/pull/67543 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: James M Snell <jasnell@gmail.com>