Get the number of decimal places of any numbers (not just quotes) bypassing Digits() in MQL4 and MQL5 - page 14
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
Can I brainstorm on a fast implementation of translating an array of structures (length multiple of sizeof(int)) to and from an int[] array?
Practical application is fast data exchange via resources. My variant is too universal, so it slows down.
These functions appeared in MT5
They do not exist in MT4 and probably will not. Therefore, we have to solve the problem with and without these functions (if they are useful).
The result will be useful to a large number of forum users here.
I have written a very simple template for brainstorming with my solution to this problem.
Result
Result
Something considerably faster than the second option. There's probably no way to speed it up.
afast implementation of translating an array of structures (length multiple of sizeof(int)) to and from an int[] array?
Something like this
Something like this.
Well done! I'll get into the code, thanks.
Sounds like ArrayCopy is a real slowpoke.
ZY From run to run, I get very different results. For example, if I change the order of the Tests, everything almost gets reversed. Apparently, I need a more objective speed measurement.
ZZZ, ArrayCopy seems to be a bit of a drag.
I remember measuring on some local task, where I had to copy a small number of elements. Up to 16 elements the for loop was much faster than the ArrayCopy one, when the number of elements was larger, the ArrayCopy one was faster. Of course, the fastest variant without loops at all (like my functions on the previous page)
The fastest way is to do it without loops at all (like my functions on the previous page).
I don't get it.
I don't get it.
My point is that for(int i=0; i<5; i++) dst[i]=src[i]; works slower than dst[0]=src[0];dst[1]=src[1];dst[2]=src[2];dst[3]=src[3];dst[4]=src[4];
which is quite obvious in view of additional operations related to loop management)
And CopyArray works much faster than both of them, as I checked it now. Maybe it depends on situation, of course.
Yes, this will work much faster (replaced for where possible by ArrayCopy, the rest is the same):
I told you, I wrote the first thing that came to mind without tests))
And CopyArray, as I checked it now, works much faster than both options, it seems. Maybe it depends on the situation, of course.
If ArrayCopy() is made on the principle of Cish memmove(),
I think the speed of ArrayCopy() depends on the speed of memory allocation, if the intermediate buffer memory is ready for copying, ArrayCopy() will be executed very quickly, if the memory is not allocated, you will start requests to the operating system to allocate memory
you can try to test - make one call to ArrayCopy() with a large data volume, thereby preparing the buffer memory for exchange, and then make a loop with ArrayCopy() with a smaller data volume for copying and with the speed measurement