修复一个缓慢的GridView [英] Fixing a slow GridView

查看:119
本文介绍了修复一个缓慢的GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图确定为什么一个asp.net网格视图是如此可怕缓慢。网格视图包含在一个自定义的子类,增加了一个自定义的寻呼机,并做一些特殊格式。此外,自定义网格视图中包含在放入更新面板网格视图,并结合它与对象的数据源,以使控制易于使用的用户控件。

I am trying to determine why an asp.net grid view is so horribly slow. The grid view is contained in a custom sub class that adds a custom pager and does some special formatting. Further, the custom grid view is contained in a user control that puts the grid view in an update panel and combines it with an object data source to making the control easy to use.

我已经查明缓慢起伏两个方面的问题:

I have traced the slow downs to two problem areas:


  • 首先是呈现HTML和视图状态的大小。我设法通过渲染视图状态到会话变量,而不是隐藏字段,以改善这一点,但我可能会改写控制不使用的ViewState的。

  • 不过,我的主要问题是控制的渲染。在一个简单的页面,唯一的控制是我的用户控制渲染40 COLS×20行的网格需要几秒钟甚至与视图状态禁用!纵观跟踪我发现,preRender阶段需要的95%的时间,所以我想这个问题是存在的。

所以,我的问题是我应该怎么解决这个问题?我有什么样的跟踪做asp.net的preRender阶段内的问题。我在那个叫但大部分的时间都花在我的code以外的用户控件的一些code。

我试着下载了asp.net,但Visual Studio中的调试符号仍然不会让我踏进code和跟踪这里不提供太多的信息。

So, my question is how should I fix this? I am having problems tracing what asp.net does inside the PreRender stage. I have some code in the user control that is called but most of the time is spent outside my code.
I tried downloading the debug symbols for asp.net but Visual Studio still won't let me step into the code, and the trace is not giving too much information here.

让别人过这种情况?我首先怀疑我的数据源,但数据库调用是快,所以这个问题是不存在的。

Have anybody else been in this situation? I first suspected my data source, but the database call is fast so the problem is not there.

推荐答案

尝试探查如蚂蚁或dotTrace - 都有免费evals或团队系统有一个,如果你许可它(合作伙伴?)。他们会告诉你在哪里的时候被消耗,或者至少帮你澄清哪里找。

Try a profiler such as ANTS or dotTrace - both have free evals, or Team System has one if you're licensed for it (Partner?). They'll show you where the time is being consumed or at least help you clarify where to look.

和听波多黎各马里亚尼在最近的炸字节播客 - 你永远花最好的40分钟。

And listen to Rico Mariani in the recent Deep Fried Bytes podcast - the best 40 mins you'll ever spend.

这篇关于修复一个缓慢的GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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