Skip to content

docs(bench): compare against the common ways to keep Node.js responsive - #6

Merged
RagedPanda merged 1 commit into
mainfrom
benchmark-vs-common-patterns
Oct 24, 2026
Merged

RagedPanda merged 1 commit into
mainfrom
benchmark-vs-common-patterns

Conversation

@RagedPanda

Copy link
Copy Markdown
Owner

The benchmark only compared against loops that don't yield, which no strategy can beat on total time. It now runs the same job with the fixes people actually reach for:

  • a plain loop, await on every row, and async's eachSeries, all of which still freeze;
  • setTimeout(0) and setImmediate after every row, which stay responsive but take 27x and 1.4x as long;
  • setImmediate every 500 rows, which freezes for 254 ms on the slow rows.

time-sliced finishes within 3% of the plain loop and its longest freeze is 11 ms.

The benchmark is split into workload, strategies, measurement and runner files, and has a warm-up pass. npm run bench -- --markdown prints the README table. async is an exact-version dev dependency, used only by the benchmark.

@RagedPanda
RagedPanda merged commit 3362eae into main Oct 24, 2026
6 checks passed
@RagedPanda
RagedPanda deleted the benchmark-vs-common-patterns branch October 24, 2026 11:59
@RagedPanda RagedPanda mentioned this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant