客户端jqgrid与服务器端jqGrid之间的性能差异 [英] Performance Difference between client side jqgrid vs server side jqGrid

查看:123
本文介绍了客户端jqgrid与服务器端jqGrid之间的性能差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个MVC项目中,在其中我将 jqGrid用于ASP.NET MVC .但是,我听说纯jquery客户端版本(jqGrid)是性能更好.这是真的?对我来说,他们似乎都在做同样的事情,只是代码在不同的地方—所有的大量工作仍然使用ajax完成. 任何建议将不胜感激.

I am working on an MVC project where I use jqGrid for ASP.NET MVC. However I am told by that the pure-jquery-client-side version (jqGrid) is better in performance. Is this true? To me they both seem to be doing the same stuff, just that the code is in different places- all the bulk work is still done using ajax. any advise would be appreciated.

编辑- 我使用网格的大多数地方都少于100行,页面大小为30,大约10-12列,主要是字符串和日期.我只有一页使用500行的网格,但是很少使用.

EDIT- most places I use the grid has less than a 100 rows,page size 30,about 10-12 columns, mostly strings and dates. Only one page I use a grid with 500 rows but that will be used rarely.

推荐答案

我不认为您应该重写现有代码,但是我可以同意,如果使用量少于1000行数据,则使用是真正的选择.

I don't think that you should rewrite your existing code, but I can agree that in case of usage less then 1000 rows of data the usage of loadonce: true is real alternative.

jqGrid的设计面向服务器端的排序,分页和过滤/搜索.因此,大多数开始使用3.7以下版本的jqGrid的用户已经很好地实现了后端.带有本机代码的SQL Server应该确保更快,因为JavaScript代码最初是作为解释器语言设计的.另一方面,当前版本的Web浏览器包含快速的JavaScript引擎.每个新版本都改善了JavaScript的性能.

The design of jqGrid is oriented on server side sorting, paging and filtering/searching. So most users who start to use jqGrid in version less then 3.7 have already good implementation of backend. SQL Server with native code should be sure more quickly as JavaScript code were originally designed as interpreter language. On the other side current versions of web browsers contain quickly JavaScript engine. Every new version improve more and more performance of JavaScript.

对于用户配对,排序或过滤操作的总时间可能很重要.它包括到Web服务器的往返时间.人们可以在生产环境中更好地进行精确测量,以比较本地网格与纯远程datatype(不使用loadonce的"json"或"xml")网格的性能.我自己使用的粗略规则是:

It could be important for the user the total time of the paring, sorting or filtering operation. It includes the round trip time to the web server. One can better do exact measure in productive environment to compare performance of local grids with grids with pure remote datatype ("json" or "xml" without usage of loadonce). The rough rule which I use myself is:

  • 如果行数少于1000行,我会使用loadonce: true,因此客户端将进行页面调度,数据排序和过滤
  • 如果总行数大于10000,则始终使用服务器端的分页,排序和过滤功能
  • if the number of rows under some 1000 rows I use loadonce: true and so client side paging, sorting and filtering of data
  • if the total number of rows larger as 10000 I use always server side paging, sorting and filtering

您的环境(网络,到服务器的往返时间等)可能是其他环境.因此,当您应该更好地在用户客户端保存数据时以及在服务器端保存时可以具有其他优势时,这是一个优势.尽管如此,在实践中使用loadonce: true可能确实非常有效.

Your environment (network, Round trip time to the server and so on) could be other. So the edge when you should better user client side holding of data and when server side holding could be other. Nevertheless the usage of loadonce: true could be really very effective in the practice.

我个人不使用您引用的jqGrid的商业版本.所以我必须自己写后端.如果使用loadonce: true,则服务器代码非常简单.调试和维护都很容易.

I personally don't use commertal version of jqGrid which you referenced. So I have to write backend side myself. In case of usage of loadonce: true the server code is very simple. It's easy to debug and to maintain.

这篇关于客户端jqgrid与服务器端jqGrid之间的性能差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆