@Tobias_Wenger wrote:
Hello
In my project I have an array with a few thousands elements which needs to be sorted. My first attempt was to use
dataSorting: ['property'], dataSorted: Ember.computed.sort('data', 'dataSorting')
but I was disappointed with the performance. It took around 30 seconds to sort and display the array. My next attempt was to use
dataSorted: Ember.computed('data', function() { return this.get('data').sortBy('property'); })
and this solution takes only around 500 milliseconds to sort and display.
I was unsure if something else in my project is causing this behavior and I created a simple Ember Twiddle app to show the performance difference: https://ember-twiddle.com/5ed7c167f51d1532dcc08ddf0b271771
Perhaps my performance measurement is not totally accurate but it shows a difference between the two sorting methods.Do I use Ember.computed.sort incorrectly or is it meant only for small arrays?
Thanks
Posts: 1
Participants: 1