Skip to content

Refactor Timers

Commit 1

Consolidates the implementation of regular and internal (_unrefActive) timers.

Includes an optimization for listOnTimeout() that previously only internal timers had. (_runOnTimeout)

Also includes some minor other cleanup.

Commit 2

Describes the How and Why of the timers implementation, as well as adding comments in spots that should allow for an easier understanding of what is going on.

The timers implementation is very efficient, at a cost. That cost is readable understandability, and this aims to improve that.


cc @bnoordhuis / @piscisaureus / @trevnorris / @misterdjules / etc?

This attempts to improve the timers implementation by consolidating the internal and regular timer logic.

I have not yet run performance testing / profiling on this, so feel free to help me out there if you are able to but I will hopefully be able to get to it shortly.

Tests pass locally, CI: https://ci.nodejs.org/job/node-test-commit/1237/

cc @nodejs/documentation and @nodejs/inclusivity I'd like thoughts on the format of the comments and their content and if they fit in well as code comments, as well as how understandable this is to people who are unfamiliar with the code.

Merge request reports

Loading