比较2 LINQ应用:意外的结果 [英] Comparing 2 linq applications: Unexpected result

查看:102
本文介绍了比较2 LINQ应用:意外的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我起草的 2的ASP.NET应用程序使用的 LINQ 。一个连接到 MS SQL服务器,另外一些专用存储器结构
这两个应用程序是 3 int字段的表工, 50万的记录(内存结构是相同的SQL Server表)。使用这些控件是常规: GridView控件 ObjectDataSource控件
在应用我计算出所需要的每个寻呼击处理的平均时间。

I drafted 2 ASP.NET applications using LINQ. One connects to MS SQL Server, another to some proprietary memory structure. Both applications work with tables of 3 int fields, having 500 000 records (the memory structure is identical to SQL Server table). The controls used are regular: GridView and ObjectDataSource. In the applications I calculate the average time needed for each paging click processing.


  • LINQ + MS SQL应用需求 0.1秒每页的变化。

  • LINQ +存储器结构要求每页的变0.8秒。

  • LINQ + MS SQL application demands 0.1 sec per page change.
  • LINQ + Memory Structure demands 0.8 sec per page change.

这是令人震惊的结果。为什么在内存中的应用程序处理数据的速度较慢作品8次比使用该应用程序的硬盘?谁能告诉我,为什么出现这种情况?

This Is shocking result. Why the application handling data in memory works 8 times slower than the application using hard drive? Can anybody tell me why that happens?

推荐答案

的主要因素将可能是算法的效率。 LINQ到对象可以与的IEnumerable< T> 输入和输出,这是一般加工顺序,而数据库可能有诱导大幅速度提升指数

The primary factor will probably be algorithmic efficiency. LINQ-to-Objects works with IEnumerable<T> inputs and outputs, which are generally processed sequentially, whereas the database may have indexes that induce substantial speed-ups.

这篇关于比较2 LINQ应用:意外的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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