views:

427

answers:

1

I have a webpage that is taking way too long and need to optimize it. Because uninformed optimizing is the devil, I need to know what exactly is holding me down. A quick glance showed me that it is probably an sql2linq query that is most likely causing the trouble.

What are techniques of pinning the performance problem in this case? Are there specific things you experienced Linq2sql is not that good at and thus should be avoided?

If needed, I can give more detail on the code that builds the query.

+1  A: 

You can use the Linq To SQL debug Visualizer, Scott Guthrie has a nice blogpost about this.

Another application that can give you valuable information is the SQL Profiler. Check this introduction., it should get you started.

I've had a couple of performace issues. I added a whole lot of TimeSpan objects with the current time before and after every Linq statement. I added a few break points to see what the differences where between all this TimeSpans. In the Watch window you can calculate the difference on the fly and immediatly see where the painpoints are. In my case it turned out to be a call the an extension method called at the wrong time.

Also the InsertOnSubmit and the SubmitChanges can cause a delay. Because my client shouldn't have to wait on that I placed the inserts on a different Thread.

Sorskoot
Sound like sane suggestions. Will check it out
borisCallens