Hi,
I get strange results with profiler where events times seem to depend of their order in the code.
You will find attached an example showing what I'm talking.
All started when I wanted to compare performances of differents solutions to get distances between 2 points.
I globally have 4 ways :
- make use of the math formula : square of ((X1-X2)^2+(Y1-Y2)^2)
- use the "ODistance" built in function
- use Advanced Direction Object (long & float values)
So I made a simple frame with 2 objects bouncing around the screen.
On each main loop, I use 4 counters to calculate the distance between these 2 objects with the 4 different solutions.
Then I use profiler to get time of each event.
On first test I get :
- counter 1 (ODistance) = 4,365 ms (26,78%)
- counter 2 (Advanced direction object with long value) : 1,954 ms (11,99%)
- counter 3 (Advanced direction object with float value) : 6,008 ms (36,87%)
- counter 4 (math formula) : 2,706 ms (16,60%)
According to this test, the fatest option is Advanced Direction Object with long value with only 1,954 ms. The second fatest solution is the math formula.
This result is consistent : I get the same result each time I make a test.
But if I change the order of events, for example :
- counter 4 (math formula)
- counter 2 (Advanced direction object with long value)
- counter 3 (Advanced direction object with float value)
- counter 1 (ODistance)
Then I get these results :
- counter 4 (math formula) : 11,590 ms (69,30%)
- counter 2 (Advanced direction object with long value) : 2,010 ms (12,01%)
- counter 3 (Advanced direction object with float value) : 1,113 ms (6,65%)
- counter 1 (ODistance) : 0,771 ms (4,61%)
This time, the fatest option is ODistance, then ADO with float value.
In fact, according to my test : profiler results seem to partially depend of the order of the events.
So, my question is : is there an exaplanation or is it some sort of bug in the profiler ?