title: searching in html table
body: <p>I have a large table with almost 5000 rows. 
  I am using the following jquery snippet to search this table for a particular text.</p>
  
  <pre><code>function searchTable(inputVal) {
  
      var table = $('.table');
  
      table.find('tr').each(function(index, row) {
          var allCells = $(row).find('td');
  
          if(allCells.length &gt; 0) {
              var found = false;
              allCells.each(function(index, td) {
                  var regExp = new RegExp(inputVal, 'i');
                  if(regExp.test($(td).text())) {
                      found = true;
                      return false;
                  }
              });
  
              if(found == true) {
                  $(row).show();
              } else {
                  $(row).hide();
              }
          }   
      });
  }
  </code></pre>
  
  <p>Now this script is taking some time to execute because it loops through each cell of each row. Considering the table having 6 cells in a row, total number of iteration is almost <strong>6*5000=30000</strong>!<br/>
  Is there any suggestion to optimize this snippet?</p>