Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You’re creating a large block of HTML code and using $('#mydiv').html(myhtml); to insert it into the DOM. You’ve profiled the code and found that the .html() method is taking longer than expected.
Use $('#mydiv')[0].innerHTML = myhtml; for faster DOM updates—if you don’t require any of the special processing that .html() provides.