0

I have a simple query running on both .NET 3.5 and .NET 4, something like this:

var x = from o in Orders
        join ot in OrderTypes on o.OrderTypeId equals ot.OrderTypeId
        where or.OrderTypeName.Contains("sales")
        select o;
var y = x.ToList();

The identical code runs on both .NET 3.5 and .NET 4, connecting to the same DB, with both dbml files generated in the respected .NET versions. Both returns the correct number of records (about 350 records). DB tables are indexed correctly. Both running in debug mode in VS 2008 and VS 2010 respectively. When I run the query in T-SQL directly in SQL Mgmt Studio, it runs fast, almost instantly. So this is definitely not a problem with the DB objects.

Here is the problem: the one running in .NET 3.5 runs fast (as it should be, less than 1 sec, I do not have precise measurement, but it's almost instant). But the one running in .NET 4 takes longer than 5 seconds.

Anybody know why is this? Or ... help?

5
  • When you run this in release mode, outside of Visual Studio, do you see the same performance difference? Commented Jun 23, 2010 at 17:00
  • I would start by running both executables in Release mode and outside of the development environment. If then you have such a big difference in performance things become worrying :-) Commented Jun 23, 2010 at 17:00
  • I agree, this is likely because VStudio 2010 is slower than VStudio 2008 and you're running with the debugger attached. Commented Jun 23, 2010 at 17:15
  • I have not tried running in release mode in VS 2010 - I will try it. In 2008, I did not see any perceivable difference between debug and release mode. I will update once I try it in 2010. Commented Jun 23, 2010 at 18:28
  • OK, I have tried several things: 1. Setting up the web.config to run with debug mode = false (makes no difference) 2. Compile the whole solution in Release mode and re-run (BIG DIFFERENCE - it is as fast as the .NET 3.5 one). So, I guess in a way the slowness is in debug compilation only. But anybody care to explain why is not behaving that way in .NET 3.5? Commented Jun 23, 2010 at 20:19

1 Answer 1

1

You could try disabling IntelliTrace in VS 2010.

Sign up to request clarification or add additional context in comments.

1 Comment

It was the Intellitrace, yes! Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.