Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timers: improve Timer.now() performance #2256

Merged
merged 4 commits into from
Jul 27, 2015

Conversation

bnoordhuis
Copy link
Member

Record the start time so we can make the return value of Timer.now()
relative to it, increasing the chances that it fits in a tagged integer
instead of a heap-allocated double, at least for the first one or two
billion milliseconds.

R=@trevnorris?

CI: https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/203/

@bnoordhuis bnoordhuis added the timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. label Jul 27, 2015
@trevnorris
Copy link
Contributor

Slick job. LGTM.

var assert = require('assert');

// Return value of Timer.now() should easily fit in a SMI right after start-up.
var Timer = process.binding('timer_wrap').Timer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const? :)

Record the start time so we can make the return value of Timer.now()
relative to it, increasing the chances that it fits in a tagged integer
instead of a heap-allocated double, at least for the first one or two
billion milliseconds.

PR-URL: nodejs#2256
Reviewed-By: Trevor Norris <[email protected]>
@bnoordhuis bnoordhuis closed this Jul 27, 2015
@bnoordhuis bnoordhuis deleted the optimize-timer-now branch July 27, 2015 22:14
@bnoordhuis bnoordhuis merged commit 543dabb into nodejs:master Jul 27, 2015
@bnoordhuis
Copy link
Member Author

Thanks, landed in 503b089...543dabb with const-ification of the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants