Since version 2018R2 we have StartProfiling and StopProfiling
I could not find any documentation pointing out how to use it, but I give it a try:
[code]Dim a As Int64
StartProfiling
For x As Integer = 0 To 1000
a = a + x
Next
StopProfiling
Break[/code]
I sometimes use the Profile Code option in the Project menu, which is not very practical when you have a large project, so I was happy which the extension being announced.
But now, how is it expected to work. ?
@Paul Lefebvre : profiling could be an interesting subject for a webinar, I think.
If your only concern is to measure the time a loop takes to execute, you really do not need any StartProfiling/EndProfiling (which I suspect are really tied to the “Profile project” thing). You can use Ticks() or Microseconds() to do so
You literally only have to call StartProfiling and StopProfiling and activate Profile Code. You run your app with the code. After quitting you will see the profile in the Navigator.
If you want to profile just a section of your code, app StopProfiling to App.Open, then surround the section(s) you want to profile with StartProfiling/StopProfiling. To get the profile at all, you still need to turn it on before running or compiling your app.
I think that’s because the “call” to the method only happened once while profiling was on. The remaining times, it was already in the method when profiling was toggled.
Move the For loop to its own method instead and see what happens: