Repository navigation
Commit 029acbf
authored
lib: stop refreshing composite AbortSignals
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: #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>1 parent 4f37a6a commit 029acbf
2 files changed
Lines changed: 46 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | 166 | | |
186 | 167 | | |
187 | 168 | | |
| |||
320 | 301 | | |
321 | 302 | | |
322 | 303 | | |
323 | | - | |
324 | 304 | | |
325 | 305 | | |
326 | 306 | | |
| |||
329 | 309 | | |
330 | 310 | | |
331 | 311 | | |
332 | | - | |
333 | 312 | | |
334 | 313 | | |
335 | 314 | | |
336 | 315 | | |
337 | 316 | | |
338 | | - | |
339 | 317 | | |
340 | 318 | | |
341 | 319 | | |
| |||
401 | 379 | | |
402 | 380 | | |
403 | 381 | | |
404 | | - | |
405 | 382 | | |
406 | 383 | | |
407 | 384 | | |
| |||
438 | 415 | | |
439 | 416 | | |
440 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
441 | 421 | | |
442 | 422 | | |
443 | 423 | | |
| |||
0 commit comments