Everyone thought the topic had been exhausted, but then ...
I redid the QuickSort sorting algorithm for an array of structures. The bottom line is that the straightforward application of a simple array sorting algorithm to sorting an array of structures leads to the "physical" movement of large amounts of data. To avoid this, I used an index table, in which all permutations are made. At the same time, I used other code optimizations. To keep the universality for different types, I used a macro wrapper from fxsaber.
As a result, sorting the MqlRates[30000] array by 8 fields took approximately 3600 ms instead of 14900 ms. That is an acceleration of more than 4x. I did not check the sorting results carefully, let it fall on beta testers.
Thanks: of course, fxsaber for the universal code.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Why? Do we have a separate topic for that?
Good idea ))))
We should start a topiccalled "Chickenshit... " )))))
Everyone thought the topic had been exhausted, but then ...
I redid the QuickSort sorting algorithm for an array of structures. The bottom line is that the straightforward application of a simple array sorting algorithm to sorting an array of structures leads to the "physical" movement of large amounts of data. To avoid this, I used an index table, in which all permutations are made. At the same time, I used other code optimizations. To keep the universality for different types, I used a macro wrapper from fxsaber.
As a result, sorting the MqlRates[30000] array by 8 fields took approximately 3600 ms instead of 14900 ms. That is an acceleration of more than 4x. I did not check the sorting results carefully, let it fall on beta testers.
Thanks: of course, fxsaber for the universal code.
UPD: If it's not obvious, access to the top structure in the sorted list: MqlRates first = Rates[ RatesIdx[0] ];