Asp.net - 从服务器创建 html 与使用 json
我的问题是关于网页的性能。我需要创建一个树视图来显示大数据(10,000)节点。 asp.net reeeview 呈现自身的方式对性能不利,因为它使用 Table 标记。我创建了一个自定义控件来使用 div 和 span 制作树视图。我可以通过两种方法来做到这一点:
创建一个自定义控件,我将在其中覆盖渲染并放置我自己的 html,该控件将出现在页面上。当连接速度较慢时,这会对性能产生影响。但其他我认为性能会很好,因为浏览器只会渲染它。无需运行 JS。
创建一个 json 对象并将其渲染在页面上(在这种情况下,页面大小将小于上面的页面)。但是 IE6-8 不支持 javascript 硬件加速器,因此需要时间来运行 js 来生成对象。
所以我的问题是哪一个更好?我的用户的速度为 3 mbps,因此速度并不重要。
My question is regardign performance of the web page. I need to create a treeview which will display large data (10,000) nodes. The way asp.net reeeview renders itself it not good for performance as it uses Table tag. I created a custom control to make a treeview using div and spans. I can do that by 2 methods:
Create a custom control where i will override the render and put my own html which will get on the page. This will have performance impact when connection speed is slow. But other i guess the performance will be godd as the browser will just render it. No JS to run.
Create a json object and render it on page (in which case, page size would be lesser then the above page). But IE6-8 do not support javascript hardware accelerator and thus would take time to run the js to make the object.
So my question is which one would be better?? My users have 3 mbps speed and thus speed does not matter as such.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,除非用户是雨人,否则他不太可能一眼就分析 10000 个节点,所以为什么不让这些节点按需加载(如果树很深 - 在节点扩展时加载,如果树是很长 - 滚动或加载)?
Telerik 演示示例: http://demos.telerik.com/aspnet-mvc/treeview/ajaxloading
Well, unless user is rainman, it is very unlikely, that he will analyze 10000 nodes at a glance, so why not to make those nodes load on demand (in case tree is very deep - load when node is expanded, in case tree is very long - load on scroll or smth)?
Telerik demo sample: http://demos.telerik.com/aspnet-mvc/treeview/ajaxloading
这不仅仅是带宽的问题。但这样的大小会影响客户端的内存泄漏。
我将创建一个单独的 Web 方法,该方法返回 JSON 并使用一些 javascript 组件(例如 ExtJs)构建树
It's not only matter of bandwidth . But such size can affect to memory leak in client.
I would create a separate Web Method that returns JSON and will build Tree using some javascript component such as ExtJs