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
Here some dirty trick, just for the fun of it.. uses a system dll's memcpy.
I've performed the following speed test. Time it takes to Append TenMillion integers to beginning of Array using methods described within this thread.
2014.01.03 00:03:05 TestingB EURUSD,M1: Number Of MilliSeconds To Complete Using RaptorUK Suggestion=6100 ... Non-Beta
2014.01.03 00:04:45 TestingB EURUSD,M1: Number Of MilliSeconds To Complete Using ArrayCopy Into Another Array=4930 ... Non-Beta
Then I decided to see how the .dll version would perform. Was running into compile problems on Current mt4, so I decided to use the Beta Built 568 as intended.
Something else I'd like to point out at this time is that my original intend was the testing of Switch vs OverLoading, using RaptorUK's method. The method works in Current mt4. However it doesn't work in mt4-Beta ... nor mt5. Example:
It appears that current mt4 always resizes from the Right. But the new terminals resize from the direction of the Series. I liked the above solution because it seemed like an easy way of creating Buffer like behavior. I cannot think up a solution for this ... and I would be interested to know if someone has an answer.
About the OverLoad vs Switch thing. Tho I haven't gotten far enough for testing the speed, it appears that Overloading would be a better option. The Switch requires Dummy Parameters (like a dummy double_array) when all I'm wanting to work with is Integer_Arrays. Also needed to pass a Dummy Double Value and the Switch. The number of parameters to pass could get out of control as the list grows. So its not looking attractive so far.
Finally got around to testing the speed of Switch vs Overload. The following results below using Beta and MT5. Ten_Million Appending. Appending method used was the Original_Post i.e vector[i] = vector[i-1].
2014.01.03 07:30:03.335 TestingD EURUSD,M1: Number Of MilliSeconds To Complete Using Overload=1232 ... Beta 568
2014.01.03 07:41:11.744 TestingD (EURUSD,M1) Number Of MilliSeconds To Complete Using Switch=562 ... MT5 880
2014.01.03 07:36:37.328 TestingD (EURUSD,M1) Number Of MilliSeconds To Complete Using Overload=515 ... MT5 880
Appears like the speed from the .Dll version earlier was faster because Beta is probably* faster then Current_MT4. With MT5 being the fastest.
I'll opt for Overloading for the reasons I'd stated earlier.
With circular buffer it is chap performance-wise to insert elements to front and lose last element.
However, sequential read/write is somewhat more costly; also one has to maintain an index to the front element and perferably use a buffer size of a power of 2:
Insert element to front with cbuffer:
On more: circular buffer
With circular buffer it is chap performance-wise to insert elements to front and lose last element.
However, sequential read/write is somewhat more costly; also one has to maintain an index to the front element and perferably use a buffer size of a power of 2:
Insert element to front with cbuffer:
What type of Voodoo is this... thank you. I'll need to study Bitwise AND (&) some more to fully understand.
Why did you remove the Second example you had about ArrayResize ?
K... Noted.
If anyone's interested in the codes I've used to generate my results ... look below. It has most of what's used.