Errors, bugs, questions - page 2880
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
no
if there are repetitive code sections, you will get optimization testing!
What difference does it make how long rand() is executed?
Let it be executed 2/3 of the test time, the main thing is to make rand() time constant
Your MQL code will use system MQL-functions, right? - what's the point of testing a perfect code?
)) the difference in speed could be 4 times in favor of one of the methods (1 to 4), but since the rand operation is 10 times slower than the rest of the code, this difference would not be visible (11 to 14)
)) The difference in speed could have been 4 times in favour of one of the methods (1 to 4), but as the operation rand 10 times longer than the rest of the code, this difference would not have been visible (11 to 14)
no it couldn't
the difference is immediately visible
let's check something developers announced in the innovations, they often write that timestamp access time for some function was optimized = not checked for a long time
2020.10.16 02:11:20.671 SpeedTst (EURUSD,H1) tst 1 : : loops=10000000 ms=353174
2020.10.16 02:11:21.967 SpeedTst (EURUSD,H1) tst 2 : : loops=10000000 ms=1296043
2020.10.16 02:11:21.967 SpeedTst (EURUSD,H1) 11304533.15558525 : 11303930.69247558
2020.10.16 02:11:44.012 SpeedTst (EURUSD,H1) tst 1 : : loops=10000000 ms=359757
2020.10.16 02:11:45.369 SpeedTst (EURUSD,H1) tst 2 : : loops=10000000 ms=1357325
2020.10.16 02:11:45.369 SpeedTst (EURUSD,H1) 11304350.05612442 : 11304321.21848488
not critical at all
rand() execution time is constant, most likely it is a common C++ function, google "rand c++ source code"
you must initialize it, but if you initialize it with constants you may encounter optimization
in general, i don't understand the dislike of rand()
an option is to initialize with something like this:
would be fast.
ran your script, imho not correct.
The main time is loading code into the cache and then into the processor
and add the discreteness of the system timer
we get... almost a random number.
you need to test it for a long time, about 100500 times, imho
rand() silences the result.
On my computer, one loop iteration takes about 1.5 nanoseconds.
With two rand(), one iteration takes twice as long - up to nearly 3 nanoseconds. You should realize that in this iteration two accesses to an item of a large array will vanish, which is also rather expensive.
It means that about 2/3 of all the iteration time is spent on two rands(). Of course, I got a little excited about "by an order of magnitude" ))
I don't understand how one can run into optimization when a pre-prepared array is filled with random numbers.
It's already discussed rand() performance once. I even tried to write a similar function myself.https://www.mql5.com/ru/forum/170952/page137#comment_12010041
result
I think the bottom line is that it makes almost no difference whether you use union or binary shift.
I use both of these methods in my iCanvas library to work with colour.
I remember, I've been doing some performance testing too, and I've concluded that it makes almost no difference. But the code with union is more readable.
I must admit that I was disappointed because I was expecting to get a noticeable performance gain with union.
I don't understand how you can run into optimization when a pre-prepared array is filled with random numbers.
I gave you 2 links on the hubr above, the first article shows well how a normal loop looks like after compilation.
I'm not saying that you can necessarily get to runtime optimization, but imho, if the array does not change, which is essentially a constant memory space with a constant size for the loop, it is not a fact that optimization will not pop up on some type of processor, and the optimization can be expected from the compiler, as well as from the processor with a cache
I think the bottom line is that it makes almost no difference what to use - union or binary shift.
I gave you 2 links on the hbr above, the first article shows well how a normal loop looks after compilation
I'm not saying that you must get to runtime optimization, but imho, if the array does not change, which is essentially a constant memory space with a constant size for the loop, it's not certain that no optimization will pop up
Judging by the results, there is no sign of optimization
The results don't give the impression of optimisation at all
yes
The argument is not about a specific code
but in the methodology of testing, I still stick to what I test optimally, and rand() although it introduces distortions, but it is a linear coefficient, not proportional, i.e. the accuracy is not very important if there is no difference in speed of less than 5%, imho
Hello, everyone!
I have a question, maybe to MQL5 developers? Maybe someone else knows... Are there plans to integrate ME compiler/code editor with some popular development environments like IDEA or Visual Studio? Meta Editor is a big pain for me. No block collapsing, no auto-substitution templates (e.g. when you start typing for(...) it immediately offers you to substitute a loop pattern and many other things), no highlighting of various important parts of the code. And so on and the like. I'm not saying that modern robots are complicated, these are large projects and there are much more serious demands to code management and team development capabilities.
No one writes their own editors and compilers any more - they all give them up and move to ready-made solutions from Microsoft, JetBrains and others. All modern editors have systems of customizable plugins that allow you to add anything you like to them. The task is not difficult in principle.
Dear Sirs, is there anyone who can give me an answer to this situation that I do not understand?
And you get even more kicking out of the programmers. Then you'll get help for sure.