timers: improve Timer.now() performance
authorBen Noordhuis <info@bnoordhuis.nl>
Mon, 27 Jul 2015 21:29:03 +0000 (23:29 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Mon, 27 Jul 2015 22:13:30 +0000 (00:13 +0200)
commit543dabb609226444fae0f9ed10f7b2360b6efda3
tree3fda08495f6b2021d5ad481e19bb0b47de8e074e
parent3663b124e6edc6df7c076c28bbc41cdc208f8baa
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>
src/env-inl.h
src/env.h
src/timer_wrap.cc
test/parallel/test-timers-now.js [new file with mode: 0644]