为什么Linq to Xml在Vista上这么慢?

时间:2023-01-21 09:05:50

I have an app that loads some XML docs into memory then runs various queries against it using Linq.

我有一个应用程序将一些XML文档加载到内存中,然后使用Linq对它运行各种查询。

The app runs fine on the live server (Windows Server 2003) and under Visual Studio 2008 on XP. But on my Vista laptop (4gb RAM, 2GHz CPU) all the Linq queries run really really slow. What should take a couple of milliseconds instead takes a couple of seconds. The funny thing is is that all other parts of the code run smoothly and quickly as they should.

该应用程序在实时服务器(Windows Server 2003)和XP上的Visual Studio 2008下运行良好。但是在我的Vista笔记本电脑(4GB内存,2GHz CPU)上,所有Linq查询的运行速度都非常慢。什么应该花费几毫秒而不是几秒钟。有趣的是,代码的所有其他部分都应该顺利而快速地运行。

Has anyone else had trouble with this type of thing?

有没有其他人遇到过这类事情的麻烦?

7 个解决方案

#1


No, I definitely have not. Take a peek at your System event log. Anything strange going on in there? Look at your CPU. Is something eating up your CPU? Is it what you think it is?

不,我绝对没有。看一下您的系统事件日志。那里有什么奇怪的事吗?看看你的CPU。是不是吃了你的CPU?这是你认为的吗?

#2


I have not had any such issues with VS 2008 and SQL DEV on my desktop and laptop. My machine specs are similar to yours.

我的台式机和笔记本电脑上的VS 2008和SQL DEV没有任何问题。我的机器规格与您的相似。

#3


No problems here, plenty of linq in my dev code base. Running Vista Ultimate (32) on my laptop for developement. Running windows 2003 on my test server.

这里没问题,我的开发代码库中有很多linq。在我的笔记本电脑上运行Vista Ultimate(32)以进行开发。在我的测试服务器上运行Windows 2003。

No issues that I have noticed.

没有我注意到的问题。

#4


Get a profiler like the one built into VS, or the profiler from Red Gate (http://www.red-gate.com/) and find out what's actually happening!

获取一个类似于内置于VS中的分析器,或者来自Red Gate(http://www.red-gate.com/)的分析器,并找出实际发生的情况!

#5


I've seen huge crazy-making performance problems under Vista that don't occur under XP - but only when I'm running a debug build under the IDE.

我在Vista下看到了巨大的疯狂制作性能问题,而不是在XP下发生 - 但只有当我在IDE下运行调试版本时。

#6


I have not seen the kind of performance issues you are reporting. See http://thinqlinq.com/Default/Querying-the-complete-plays-of-Shakespeare-using-LINQ-to-XML.aspx for a sample that queries the complete works of Shakespeare finding the characters with the most number of lines. When spanning 40 XML files each a hundred K in size resulting in a single 5 meg XML document, I'm still seeing sub-second querying time.

我还没有看到您报告的性能问题。请参阅http://thinqlinq.com/Default/Querying-the-complete-plays-of-Shakespeare-using-LINQ-to-XML.aspx,查询查询莎士比亚全部作品的样本,查找数量最多的字符线。当跨越40个XML文件,每个大小为100 K,产生一个5兆的XML文档时,我仍然看到亚秒级的查询时间。

You may be running into issues with a complex join or recursive where clause that is causing your performance to degrade.

您可能遇到了复杂连接或递归where子句的问题,导致性能降低。

#7


How fast is the hard drive in your laptop. You may just be seeing the cost of loading a large xml file from disk.

笔记本电脑中的硬盘有多快?您可能只看到从磁盘加载大型xml文件的成本。

#1


No, I definitely have not. Take a peek at your System event log. Anything strange going on in there? Look at your CPU. Is something eating up your CPU? Is it what you think it is?

不,我绝对没有。看一下您的系统事件日志。那里有什么奇怪的事吗?看看你的CPU。是不是吃了你的CPU?这是你认为的吗?

#2


I have not had any such issues with VS 2008 and SQL DEV on my desktop and laptop. My machine specs are similar to yours.

我的台式机和笔记本电脑上的VS 2008和SQL DEV没有任何问题。我的机器规格与您的相似。

#3


No problems here, plenty of linq in my dev code base. Running Vista Ultimate (32) on my laptop for developement. Running windows 2003 on my test server.

这里没问题,我的开发代码库中有很多linq。在我的笔记本电脑上运行Vista Ultimate(32)以进行开发。在我的测试服务器上运行Windows 2003。

No issues that I have noticed.

没有我注意到的问题。

#4


Get a profiler like the one built into VS, or the profiler from Red Gate (http://www.red-gate.com/) and find out what's actually happening!

获取一个类似于内置于VS中的分析器,或者来自Red Gate(http://www.red-gate.com/)的分析器,并找出实际发生的情况!

#5


I've seen huge crazy-making performance problems under Vista that don't occur under XP - but only when I'm running a debug build under the IDE.

我在Vista下看到了巨大的疯狂制作性能问题,而不是在XP下发生 - 但只有当我在IDE下运行调试版本时。

#6


I have not seen the kind of performance issues you are reporting. See http://thinqlinq.com/Default/Querying-the-complete-plays-of-Shakespeare-using-LINQ-to-XML.aspx for a sample that queries the complete works of Shakespeare finding the characters with the most number of lines. When spanning 40 XML files each a hundred K in size resulting in a single 5 meg XML document, I'm still seeing sub-second querying time.

我还没有看到您报告的性能问题。请参阅http://thinqlinq.com/Default/Querying-the-complete-plays-of-Shakespeare-using-LINQ-to-XML.aspx,查询查询莎士比亚全部作品的样本,查找数量最多的字符线。当跨越40个XML文件,每个大小为100 K,产生一个5兆的XML文档时,我仍然看到亚秒级的查询时间。

You may be running into issues with a complex join or recursive where clause that is causing your performance to degrade.

您可能遇到了复杂连接或递归where子句的问题,导致性能降低。

#7


How fast is the hard drive in your laptop. You may just be seeing the cost of loading a large xml file from disk.

笔记本电脑中的硬盘有多快?您可能只看到从磁盘加载大型xml文件的成本。