Exactly the same (for integers.)
theoretically, yes it is faster, but it still depends on the mql compiler if it checks first the "<" and execute right away when true. speed is basically in milliseconds so you will not feel the difference in regular script but if you run script with exhausting loop and the condition is in the middle of the loop, the first method will help.
Can you justify your theory with a source ? I don't think so.
We are not talking here about milliseconds, but about nanoseconds.
There
is
no difference in execution speed between these 2 options.
A little weird that 2 things same as 1
Assembler wise it's exactly the same thing.
one machine instruction for greater and one machine
instruction for greater equal. same thing.
Assembly
conditions
- www.tutorialspoint.com
Can you justify your theory with a source ? I don't think so.
We are not talking here about milliseconds, but about nanoseconds.
There
is
no difference in execution speed between these 2 options.
I respect your belief but it is actually different. The layman's explanation is this...
"b<11" is like asking one question.
"b<=10" is like asking two questions. The first question is "Is b less than 10?" if true it will execute the script for "true". If it's false, it raise the next question "Is b equal to 10?". Theoretically each question consume milliseconds of execution. If the first question is false then it consumes more time as it will ask the next question.
That is in theory on designing a compiler. I don't know how MQL compiler did it so I don't really know if this theory is applicable with it.
I used to be a compiler designer and assembly language programmer for more than 10 years that's why I know. I just got tired of it so I quit and looked for something more exciting.
I respect your belief but it is actually different. The layman's explanation is this...
"b<11" is like asking one question.
"b<=10" is like asking two questions. The first question is "Is b less than 10?" if true it will execute the script for "true". If it's false, it raise the next question "Is b equal to 10?". Theoretically each question consume milliseconds of execution. If the first question is false then it consumes more time as it will ask the next question.
That is in theory on designing a compiler. I don't know how MQL compiler did it so I don't really know if this theory is applicable with it.
I used to be a compiler designer and assembly language programmer for more than 10 years that's why I know. I just got tired of it so I quit and looked for something more exciting.
You must be kidding. "b<=10" is absolutely not "two questions", as explained in the links posted by Amir and me, there is an instruction at CPU level for both. If the compiler translate "b<=10" in 2 instructions it's just a bad compiler.
Are you sure MQL uses that instructions? It's all in theory as I have said. No one among us knows what's inside the compiler. Your theory is as good as mine.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
<11 faster than <=10?
for example
vs
Is the first one faster bc its just one thing < vs <=? Worth it?