how to tell how long it took a query to run?
in both LINQPad 4 and 5, I will often run a query (C# Expression) and see while it's running the timer going to show how long it's taking so far. Even when the query takes well over 30 seconds, once it completes the status bar says something like "Query successful (00:00.073)". I'm not sure which part of the process the 73 milliseconds is from, but outside of adding my own Stopwatch at the top and bottom, is there a way to tell how long the query took to run?
Is this a LINQPad bug and the time shown after 'Query successful' should have been the full runtime?
Thanks!
Is this a LINQPad bug and the time shown after 'Query successful' should have been the full runtime?
Thanks!
Comments
I've got a query that does 3 levels of sort and then a Take(100) and takes between 16 to 20 seconds to run consistently (even if re-running it just after running it)
What I'm seeing is:
- if the query only writes to the Output window (doing doing the 16 second query but adding .Count() instead of writing out the rows), then the time listed in the status bar is accurate
- if the query writes to the html / rich text output, then the time list is accurate
- if the query writes to the data grid output, even though the query still takes the same 16 to 20 seconds to run, the status bar lists a time well below one second
version v5.02.03(AnyCPU)
Edit: I can reproduce with the following C# statements query, although it takes a couple of seconds to complete, it shows "Query successful (00:00.000)" for me:
http://forum.linqpad.net/discussion/comment/1819/#Comment_1819
In other words, the enumeration of the datagrid is deferred to another thread / process and therefore the query has finished earlier.
Can be omitted by adding a .ToArray() to force data retrieval in the query process: