start_time = time.time()
main()
print time.time() - start_time, "seconds"

reading up


on this page there is a nice description of the single threaded nature of javascript:
http://javascript.info/tutorial/events-and-timing-depth


this snippet displays the latency on your browser for executing the next cycle:

var i = 0, diff = 0, d = new Date()

var timer = setTimeout(function() {
diff += new Date() - d
timer = setTimeout(arguments.callee, 0)
if (i++==1000) {
clearTimeout(timer)
alert("Resolution: "+diff/i)
}
d = new Date()
}, 0)


The key to the above, and many timing issues in javascript is:
setTimeout(function_call, 0)

also some considerations for making sure that changes to the DOM are re-rendered before continuing to the next display update.


http://www.google.com/webhp?sourceid=chrome-instant&ie=UTF-8#hl=en&tbo=d&output=search&sclient=psy-ab&q=browser%20event%20timing&oq=&gs_l=&pbx=1&fp=4ed87bf74c3b6306&bav=on.2,or.r_gc.r_pw.r_qf.&bvm=bv.41018144,d.aWc&biw=987&bih=887
http://www.w3.org/TR/workers/