Avoid long running scripts

Scripts will pause DOM construction and event processing of the page. If your script needs a lot of time to complete, breat it up into multiple steps so the browser can interleave work of its own and maintain page responsiveness to the visitor.