Note that there are some explanatory texts on larger screens.

plurals
  1. POInternet Explorer Javascript performance problem
    primarykey
    data
    text
    <p>JavaScript performance in Internet Explorer sucks. No news there. However there are some tips and tricks to speed it up. For example, there is this <a href="http://blogs.msdn.com/ie/archive/2006/08/28/728654.aspx" rel="nofollow noreferrer">three</a> <a href="http://blogs.msdn.com/ie/archive/2006/11/16/ie-javascript-performance-recommendations-part-2-javascript-code-inefficiencies.aspx" rel="nofollow noreferrer">part</a> <a href="http://blogs.msdn.com/ie/archive/2007/01/04/ie-jscript-performance-recommendations-part-3-javascript-code-inefficiencies.aspx" rel="nofollow noreferrer">series</a>. Still I find myself unable to squeeze decent performance out of it. Perhaps some of you have an idea what else to do so it was speedier?</p> <p>What I want to do is create a medium-size table from scratch in Javascript. Say, 300 rows, 10 cells each. It takes at about 5-6 seconds on my computer to do this. OK, granted, it's a 5 year old rig, but that's still too much. Here's my dummy code:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; function MakeTable(parent) { var i, j; var table = document.createElement('table'); var insertRow = table.insertRow; for ( i = 0; i &lt; 300; i++ ) { var row = insertRow(-1); for ( j = 0; j &lt; 10; j++ ) { var cell = row.insertCell(-1); cell.innerHTML = i + ' - ' + j; } } parent.appendChild(table); } &lt;/script&gt; &lt;div onclick="MakeTable(this);"&gt;Click Me!&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Added:</strong> Hmm, apparently string-concatenation (with array.join) is the only way to go. Well, sad, of course. Was hoping to do it the "proper" DOM-way. :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload