PDA

View Full Version : Modifying multiple records in a store slow if store sorted on modified values



anselmtmcclain
28 Jun 2017, 9:15 AM
Hi -

We recently ran into serious performance issues where we were updating multiple records in a large-ish (~1000 records) store that was sorted on a frequently updated field. We initially thought there was some kind of grid / rendering slowdown, but it turned out it was store's internal Collection chewing up CPU trying to autoSort its records after each record modification.

By disabling the (private!) autoSort property of the Collection before performing our modifications, then re-enabling and doing a single sort afterwords, the performance problem was completely resolved.

We had bracketed the updates between calls to store.beginUpdate() and store.endUpdate() and had expected that to be all we needed to do, but it wasn't the case.

Please see https://fiddle.sencha.com/#fiddle/22ac for a simple test case - note the two buttons on the bottom toolbar. Hopefully that + the comments in the code are self-explanatory.

Are we missing something? Is there a better way to handle this? Obviously would prefer not to have to mess with a private property. Bug is present in 6.2.1.167 Classic (which we are using) but as per fiddle we get the same issue in 6.5.

Thanks - Anselm