title: React.js sorting large Arrays
body: <p>I have implemented react/js sorting grid base on this <a href="http://zippyui.com/react-datagrid/#/examples/sorting" rel="nofollow">React library</a></p>
  
  <p>things work very nice, but I am getting slower and slower response when I have over 50k objects in in array. Over 50k takes around 4 seconds. Over 250k it takes 10 seconds.</p>
  
  <p>I do not have complicated data structure, this is what I have:</p>
  
  <pre><code>var myData = [{name: "my name", description: "my description", grade: 3}]
  </code></pre>
  
  <p>I am using <a href="https://www.npmjs.com/package/sorty" rel="nofollow">sorty</a> for this task. Have I reached a limitation of the technology, or I am doing something wrong?</p>
  
  <p>I know it cant be instant, I am just trying to increase speed as much as possible.
  Any insight is appreciated.</p>
  
  <p>After lots of experimenting, I decided to try sorting with underscore before trying to make my own sorting function.</p>
  
  <pre><code>if (SORT_INFO.dir === -1){
          var data =  _.sortBy( this.state.data, SORT_INFO.name ).reverse();
      } else {
          var data =  _.sortBy( this.state.data, SORT_INFO.name );
      }
  </code></pre>
  
  <p>What surprised me is the speed of it. It is roughly 10 fold. 1mil object in array, takes maybe 4 second. I wonder why?</p>