View Full Version : record.set performance issue

9 Oct 2014, 1:02 AM
Hi ,

In EXT 4.2 grid I am updating many records(multiple rows, multiple cell in each row) using below statement -

record.set(dataIndex, value);

However it seems there is a performance issue as it updates only 8 rows per second.

Below was the scenario -
Browser - chrome
Total grid Rows - 200
Updated Records - 50 rows, 3 columns each , total 150 records

I also tried to use record.set in between beginEdit and endEdit and got some performance benefit also.
Now 12 rows can be updated in a second.

However still the result is not satisfying as time it takes to update many records is clearly noticeable.

I checked afterEdit of AbstractStore and it seems fireEvent takes much time here , I am not sure what can be done to improve it ?

afterEdit : function(record, modifiedFieldNames) {
var me = this,
i, shouldSync;

if (me.autoSync && !me.autoSyncSuspended) {
for (i = modifiedFieldNames.length; i--;) {
// only sync if persistent fields were modified
if (record.fields.get(modifiedFieldNames[i]).persist) {
shouldSync = true;
if (shouldSync) {
me.onUpdate(record, Ext.data.Model.EDIT, modifiedFieldNames);
me.fireEvent('update', me, record, Ext.data.Model.EDIT, modifiedFieldNames);
Is there any way by which performance can be improved further ? like instead of firing update for every row can it be modified to fire update for all selected row only once ?

9 Oct 2014, 6:04 AM
What about using the following sequence to perform the update:

Suspend events on the store
Update the records
Resume events on the store
Refresh the grid's view manually
Here's an example:bi4

9 Oct 2014, 10:08 PM
They say Sugoi in Japanese for something great.

Thanks for the idea of suspending events on store and resuming it later. It works like charm.