title: Why does removing elements take more time than adding elements?
body: <p>I have a table with a lot of rows (like 10.000).<br>
  (Note: I realize it doesn't make sense to have a table that large, but I'd like to understand the below behavior).<br>
  When I receive new data I want to clear the rows first. Weirdly enough, clearing the table takes much longer than building the rows from scratch. Clearing the table rows with <code>html("")</code> or plain JS <code>innerHTML = ""</code> takes 1.5 minutes, much more than building the rows themselves, which takes less than a second. </p>
  
  <p>So my question:<br>
  - Why does removing elements take more time than adding them? What happens 'behind the scenes'?<br>
  (Please note my question is a <strong>Why</strong> one, I'm not looking for possible workarounds).  </p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>I noticed that the table row and cells have floating definitions applied to them, and when I remove the float, the table is emptied out in an instance.<br>
  I'd still really like to understand <strong>why</strong> the float makes the removal of the rows so much slower.<br>
  Here a fiddle: <a href="https://jsfiddle.net/maaikeb/t5pduuue/" rel="noreferrer">https://jsfiddle.net/maaikeb/t5pduuue/</a><br>
  In Chrome it takes 25 seconds to empty the table, and only 23 <strong>ms</strong> to append it to the DOM.</p>
  
  <p>*I read the below posts, but they talk more about possible solutions, and less about why removing elements takes more time than adding them, what actually happens when you remove them   </p>
  
  <p><a href="https://stackoverflow.com/questions/7537070/jquery-empty-is-very-slow">jQuery empty is very slow</a><br>
  <a href="https://forum.jquery.com/topic/jquery-empty-is-very-slow" rel="noreferrer">jQuery empty is very slow</a><br>
  <a href="https://stackoverflow.com/questions/170997/what-is-the-best-way-to-remove-a-table-row-with-jquery">What is the best way to remove a table row with jQuery?</a><br>
  <a href="https://stackoverflow.com/questions/16258658/deleting-table-rows-in-javascript">Deleting table rows in javascript</a><br>
  <a href="https://stackoverflow.com/questions/723112/jquery-fastest-way-to-remove-all-rows-from-a-very-large-table">jquery - fastest way to remove all rows from a very large table</a>    </p>