node/test/parallel/test-timers-now.js
Ben Noordhuis 543dabb609 timers: improve Timer.now() performance
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: https://github.com/nodejs/io.js/pull/2256
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-07-28 00:13:30 +02:00

9 lines
251 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
// Return value of Timer.now() should easily fit in a SMI right after start-up.
const Timer = process.binding('timer_wrap').Timer;
assert(Timer.now() < 0x3ffffff);