Disable Sql, Lambda And Il For Performance Testing |
![]() ![]() |
Disable Sql, Lambda And Il For Performance Testing |
Jun 22 2009, 02:27 PM
Post
#1
|
|
|
|
Is it possible to disable output for lamba, SQL and IL panels. I would like to test performance of Linq queries using Linqpad, but I guess output for these panels might interfere with performance measurements...
|
|
|
|
Jun 22 2009, 04:22 PM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 203 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
Hi there
The SQL tab is fairly minimal in its overhead - I don't think it will make any difference to your performance stats. The lamdba tab is populated (along with the results tab) only when you dump query results. When performance testing, you shouldn't dump queries because this will incur some overhead - instead, call ToArray() on them or enumerate them without writing anything. Finally, the IL tab is populated only when you click it. So there's zero overhead there. Regards Joe |
|
|
|
Jun 22 2009, 10:58 PM
Post
#3
|
|
|
|
In one of my tests, I compare the results of 2 queries in one script, something like:
for( int i=0; i<1000; i++) { var q = <query1>.ToList(); } for (int i=0; i<1000;i++) { var q2 = <query2>.ToList(); } I used Stopwatch to measure time. Depending on which query was put first in code, the first one consistently run faster. Hi there The SQL tab is fairly minimal in its overhead - I don't think it will make any difference to your performance stats. The lamdba tab is populated (along with the results tab) only when you dump query results. When performance testing, you shouldn't dump queries because this will incur some overhead - instead, call ToArray() on them or enumerate them without writing anything. Finally, the IL tab is populated only when you click it. So there's zero overhead there. Regards Joe |
|
|
|
Jun 24 2009, 03:31 AM
Post
#4
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 203 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
Do you get the same results in Visual Studio?
I'd expect the opposite - the first query that you run often takes the longest for a number of reasons. One being that it's incurring the cost of building the metamodel. Joe This post has been edited by JoeAlbahari: Jun 24 2009, 03:32 AM |
|
|
|
Jun 25 2009, 01:53 PM
Post
#5
|
|
|
|
Didn't try it in Visual Studio.. could it be, because of the SQL pane is building a string with all SQL statements, and the longer it gets, the more time it needs to add ? Easiest way to know for sure would be to be able to disable those panes, and see what happens.
|
|
|
|
Jun 25 2009, 06:32 PM
Post
#6
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 203 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
I've made a preview build that lets you test this by theory by disabling the SQL translations. You can download it here:
www.linqpad.net/preview/LINQPad.exe Then enter the following into your query before doing anything else: LINQPad.ExecutionEngine.SqlTranslationsEnabled = true; Joe |
|
|
|
Jul 7 2009, 10:36 PM
Post
#7
|
|
|
|
Finally had the time to test it, and it looks good...
I now get consistent results... Thank you very much!! I've made a preview build that lets you test this by theory by disabling the SQL translations. You can download it here: www.linqpad.net/preview/LINQPad.exe Then enter the following into your query before doing anything else: LINQPad.ExecutionEngine.SqlTranslationsEnabled = true; Joe |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 7th November 2009 - 03:56 PM |