joyent/node — pull request #4189 by AlexeyKupershtokh (2012-10-24 05:52:26+00:00)
Title: 1.5x speed up setTimeout()

Main points are:
1. Do not set Timeout._when property at all -> less memory footprint.
2. Set Timeout._idleStart in the constructor due to this recommendations: http://s3.mrale.ph/nodecamp.eu/#55
3. Do not re-calculate Timeout._idleStart when it is set already.
4. Do not modify item in insert() when msecs < 0

This is not about timers accuracy. It's just about the time setTimeout() call take.

Benchmark results are the following:
node 0.8.12 + timers.js from 0.9.2:
```
wait...
smaller is better
startup: 11257
done: 999
```
node 0.8.12 + optimized timers.js from 0.9.2:
```
wait...
smaller is better
startup: 7610
done: 999
```
node 0.9.2 reproduces these results as well.