title: fast way in javascript to update existing array with new values
body: <p>I'm starting with a large array containing nested objects (~34,000 items), and I'm polling every 5 seconds, receiving updates to the array (generally 2-3 updates at a time) and the new array only contains items that have changed (so for example, if only 3 items changed, I only get those 3 items in my updated array.)</p>
  
  <p>I tried the following using underscore, but it takes up to 9 seconds, I need like a second or less. </p>
  
  <pre><code>  getUniqueUnion(new, old) {
      return uniq(union(new, old), false, function(item) {
        return item.info.id;
      }); 
    }
  </code></pre>
  
  <p>Anyone have a suggestion for a fast approach? If it helps, the unique key would be info.id, and the only change I'm really looking to detect (reason I need to update the item) is if the inStock value changes. In other words, if the inStock value hasn't changed, I dont need to make any update to that array item. </p>
  
  <p>Example arrays:</p>
  
  <pre><code>const originalData = [
    {
      info: {
        id: 1
      },
      moreInfo: {
        name: 'hamburger',
        inStock: true
      }
    },
    ... // 33,999 more
  ]
  
  
  
  const updatedData = [
    {
      info: {
        id: 1
      },
      moreInfo: {
        name: 'hamburger',
        inStock: false
      } 
    },
    ... // maybe 2 more
  ]
  </code></pre>
  
  <p>So the final array would include the first item to have moreInfo.inStock === false</p>