title: Underscore.js performance issue - Can i use _.defer
body: <p>In an simple web app that i am building using underscore.js and jquery. For a list of all people ( js object ) I am filtering out list of all the places (js object) they visited. People list is a html table with a <code>td</code> having places image icon which on click displays list of all places they visited. <strong>Icon needs to be shown only for people who have visited at the least one place</strong>. The problem here is that people and places count comes around <code>2000</code>, <code>100</code>. So the code below executes <code>2000*100</code> combinations. The browser complains me of unresponsive script. Code is provided below</p>
  
  <pre><code>_.each(peopleList, function (person, index, list) {
  
      //filter the respective places for people
      var visitedPlaces = _.filter(places, function (place) {
          return place.PeopleId == person.Id;
      });
  
      if (_.isEmpty(visitedPlaces)) {
          $("a#" + place.PeopleId).remove();
      }
  });
  </code></pre>
  
  <p>Dead simple isn't it. For each person check if visited places has him tracked. How do i optimize the above code to unblocking and responsive. Tried putting in <code>_.defer</code> and <code>_.delay</code> at some places but no improvement</p>