You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Give me the full code of your test
here you go, but I don't see the point in discussing rand() again, alternatively replace it with some inc++ variable
yeah... I have an error in my code, I want to output time in seconds, but I get 10 times more, I divided it correctly by 1 000 000, who can tell me what's the reason?
here you go, but I don't see the point in discussing rand() again, alternatively replace it with some inc++ variable
yeah... Some kind of error in my code, I want to output the time in seconds, but I get 10 times more, I divided it correctly by 1 000 000, who can tell me what's the reason?
BOMB.
here's your code that proves it's the other way around.
BOMB
Here's your code that proves the opposite.
I just switched the checks around.
I just swapped the checks
2020.11.02 21:01:38.590 22222 (USDCHF,H1) cnt: loops = 1000 seconds=821.7159
2020.11.02 21:01:52.353 22222 (USDCHF,H1) ArraySize: loops = 1000 seconds=807.9415
What test? ))
You yourself have shown both variations of the cycle condition.
Igor gave the code above too.
Just measure loop's performance with variable size and with ArraySize() in the loop condition.
Prove me wrong)
because in my test they are the same
I just switched the checks around.
Yeah, you have to do that.
I was too lazy this time.
Wrapped the tests in an external loop, got it like this:
2020.11.02 22:06:43.557 SpeedTst (EURUSD,H1) ArraySize: loops = 1000 seconds=117.4626
2020.11.02 22:06:58.328 SpeedTst (EURUSD,H1) cnt: loops = 1000 seconds=102.7337
2020.11.02 22:07:13.075 SpeedTst (EURUSD,H1) ArraySize: loops = 1000 seconds=87.9782
2020.11.02 22:07:27.850 SpeedTst (EURUSD,H1) cnt: loops = 1000 seconds=73.2461
2020.11.02 22:07:42.598 SpeedTst (EURUSD,H1) ArraySize: loops = 1000 seconds=58.4859
2020.11.02 22:07:57.380 SpeedTst (EURUSD,H1) cnt: loops = 1000 seconds=43.7522
2020.11.02 22:08:12.891 SpeedTst (EURUSD,H1) ArraySize: loops = 1000 seconds=28.9861
2020.11.02 22:08:28.874 SpeedTst (EURUSD,H1) cnt: loops = 1000 seconds=13.4910
Yes, it has to be done.
I was too lazy this time.
Wrapped the tests in an external loop, got this
2020.11.02 22:06:43.557 SpeedTst (EURUSD,H1) ArraySize: loops = 1000 seconds=117.4626
2020.11.02 22:06:58.328 SpeedTst (EURUSD,H1) cnt: loops = 1000 seconds=102.7337
2020.11.02 22:07:13.075 SpeedTst (EURUSD,H1) ArraySize: loops = 1000 seconds=87.9782
2020.11.02 22:07:27.850 SpeedTst (EURUSD,H1) cnt: loops = 1000 seconds=73.2461
2020.11.02 22:07:42.598 SpeedTst (EURUSD,H1) ArraySize: loops = 1000 seconds=58.4859
2020.11.02 22:07:57.380 SpeedTst (EURUSD,H1) cnt: loops = 1000 seconds=43.7522
2020.11.02 22:08:12.891 SpeedTst (EURUSD,H1) ArraySize: loops = 1000 seconds=28.9861
2020.11.02 22:08:28.874 SpeedTst (EURUSD,H1) cnt: loops = 1000 seconds=13.4910
Now swap them in the loop and be amazed
Now swap them in the loop and you will be surprised
I will not be surprised. I know that the compiler can optimize code on the fly
but, imho, in nested loops, you still should not call ArraySize() unnecessarily.
Of course, it may sometimes be inconvenient, so I do the loop via a temporary variable - your version № 2
imho, it is reliable and you understand what will happen
Well I can't say anything against IMHO.
On very large replays, my wins have become random for the first and second method... Most likely it became dependent on current CPU cache and overall load.
My question wasn't about the loop - it was about how the function unfolded. Just as an example was ArraySize
The result;
for (int i=0; i<ArraySIze(mas); i++) == for (int i=0; i<size; i++)
But if we add the initialization of the size variable to the second part, then the first method takes the lead for the time of initializing this variable and equating it with the value.
If you change the size of arrays in the body of the loop, on-the-fly optimization does not work
so change the code:
then the first method takes precedence, for the time of initializing this variable and equating it with a value, it's noticeable only at high repetitions
it doesn't work
runtime optimization will be in the lead
you can't test such simple mashidas without the profiler, in general, you can write in a loop, or you can test in the tester, speed is important for it