Features of the mql5 language, subtleties and tricks - page 321
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
The preprocessor knows nothing about the value of 'o' or any variable.
What are you REALLY trying to achieve ?
This way you can use the compilation conditions
Works just fine. Thank you.
Why is the second option 20 times slower?
1. calling an external DLL.
2. copying from memory.
Why does the second variant work 20 times slower?
@amrali, @Nikolai Semko, thank you!
I wanted to implement direct access to the array without checking if the index is correct.
@amrali, @Nikolai Semko, thank you!
I wanted to implement direct access to the array without checking if the index is correct.
This variant is three times slower.
This option is three times slower.
Apparently, the compiler sees 8 different indexes, 8 separate boundary checks at each iteration, and as a result it loses autovectorisation (does not recognise the pattern).
0.3 ns per iteration - I think this is almost the limit. Even C++ DLL will not give a big gain. We are practically stuck in memory bandwidth, not CPU bandwidth.
Further only to change the architecture of the solution. Perhaps using GPU (OpenCL) will give some results, but this is only in case there are multiple operations on one buffer or more complex calculations than just sum. For a single sum - GPU can be comparable or even slower because of transfer overhead.