Performance optimization for immediate timeouts

Created a shim for immediate timeouts to use setImmediate when
supported by the browser or setTimeout otherwise.
The performance difference of setImmediate is much improved over
setTimeout where it exists
(http://jsperf.com/setimmediate-vs-settimeout)