Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
improving performance of loading local data in jqGrid
31/08/2014
10:06
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

during writing the answer on the stackoverflow I found out that the line

var p = $.extend(true,{
    // there are here different default values of jqGrid parameters
}, $.jgrid.defaults, pin ||{});

of jqGrid code is the bottleneck during loading of large number of local data. The demo demonstrates the problem. It creates jqGrid with 90,000 rows of data entered directly using data: gridData input parameter. If one don't specify sortname input parameter then jqGrid displays unsorted data.

The problem is that deep version (with true as the first parameter) of $.extend works very slowly with arrays. Especially slowly works $.extend in Internet Explorer. To improve performance one can either use non-deep $.extend (but one can have some compatibility issues) or just temporary remove data parameter from the list of input parameters and include it back after the call of $.extend:

var localData;
if (pin != null && pin.data !== undefined) {
    localData = pin.data;
    pin.data = [];
}
var p = $.extend(true,{
    // there are here different default values of jqGrid parameters
}, $.jgrid.defaults, pin ||{});
if (localData !== undefined) {
    p.data = localData;
}

The demo uses jqGrid code fixed in the described above way and it works much quickly especially in Internet Explorer. I suggest to fix the main code of jqGrid in the way. I didn't posted the above changes as new pull request only because there are exist another pending pull request which I posted before.

Best regards
Oleg

08/09/2014
11:12
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello Oleg,

Thanks for this investigation and examples (as usual Smile)

I think that this is rather problem of jqQuery and not of jqGrid.

I'm following the philosophy, that the problems should be resolved at its origin.

 

I have tested your both examples (slow and fast ) in IE11 and have a impression that there is no diffrenece.

Do you have any measurements? I will try measure both examples  and see if there are a big difference I will accept eventually this request.

 

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

08/09/2014
14:51
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

I modified the demo: the original and "the improved". Different web browsers shows different time, for example

IE11: original about 830, improved about 160, 

IE10: original about 600, improved about 120,

Chrome 37.0.2062.103: original about 1050, improved about 130

In all tests the "improved" version worked noticeably quickly.

About your comment rather the problem is jQuery problem or jqGrid problem. I see the problem so. If jqGrid are used with data input parameter it's not really required to make deep copy of it. My demos shows, that making deep copy of a array parameter could take relatively many time. The only parameter which can be really large is data parameter. If jqGrid will don't use it in $.extend(true,{...}) then the code could be just more quickly. So I see the suggested change as performance optimization in jqGrid and not as workaround of some jQuery bug. One can suggest a lot of optimizations in jqGrid code, but the most from there will improve performance in less then 0,1%. What I suggest can improve loading of large grid in multiple times just by removing some operation (deep copy of data parameter) which are not really required for jqGrid.

Best regards
Oleg

P.S. I posted the pull request with the suggestions.

13/09/2014
12:29
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello Oleg,

 

I have performed my tests and would say - incredible improvement.

My tests actually are measuring only the extend in order to isolate the fix.

You know that I'm very sensitive when we speak about performance.

Just to tell you - with your data in FireFox (only extend)

 

Original 7650  - improved - 1.

Since I can not believed on this I have made this several time with diffrent data, but the result was the same.

 

BIG THANKS.

 

Best Regards

Tony

 

P.S. Just merged the request.

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
38 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information