joyent/node — pull request #4193 by AlexeyKupershtokh (2012-10-25 11:00:09+00:00)
Title: 1.5x speed up setTimeout()

Main points are:
1. Do not set Timeout._when property at all -> save a relatively slow Date.now() call & smaller memory footprint.
2. Set Timeout._idleStart and Timeout._onTimeout in the constructor due to these recommendations: http://s3.mrale.ph/nodecamp.eu/#55. Many runs of benchmark/settimeout.js verify this gives about 1-2% gain too.

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.