Особенности языка mql5, тонкости и приёмы работы - страница 256
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
У меня не совпадает на GBPUSD, изменил только первый принт.
ну если контрольная сумма одинакова с расчетом через структуру, тогда по MN1 есть дырки истории.
Может история не загрузилась еще, или диапазон проверки больше исторических данных
Можно резюмировать
Набор быстрых функций без применения структуры для получения параметров даты и времени до 2100 года по одному входному параметру datetime:
With the help from codes by fxsaber here and here and some codes from this webpage source code, I was able to devise a very fast function to get year, month and day of year.
I updated the previous test done by Nokali before.
Results:
Edit:
GetMonthFast() uses branchless code, no if statements, and I think memoization is not required because it takes only 2 nanosec to execute.
May be the comparisons with TimeToStruct() is not fair enough (it has to calculate all the other members of the struct), but it was included here to verify checksums.With the help from codes by fxsaber here and here and some codes from this webpage source code, I was able to devise a very fast function to get year, month and day of year.
I updated the previous test done by Nokali before.
Results:
Edit:
GetMonthFast() uses branchless code, no if statements, and I think memoization is not required because it takes only 2 nanosec to execute.
May be the comparisons with TimeToStruct() is not fair enough (it has to calculate all the other members of the struct), but it was included here to verify checksums.Вау! Браво!
Спасибо, Amrali
Conclusion:
(1) The decoding of datetime variables into the date components (year, month and day) is fast enough. The TimeToStruct() function is doing a very good job at extraction.
(2) The encoding routines for converting date components into datetime variables are really slow, encoding benchmarks here had showed speed-ups of100x times or more.
I think the StructToTime () and StringToTime () need some consideration from the developers , because these functions are frequently used in experts / indicators on the platform to encode datetime .
Заключение:
(1) Декодирование переменных datetime в компоненты даты (год, месяц и день) происходит достаточно быстро. Функция TimeToStruct() очень хорошо справляется с извлечением данных.
(2) Процедуры кодирования для преобразования компонентов даты в переменные даты и времени работают очень медленно, тесты кодирования здесь показали ускорение в 100 раз и более.
Я думаю, что StructToTime ( ) и StringToTime () требуют некоторого рассмотрения со стороны разработчиков , поскольку эти функции часто используются в экспертах/индикаторах на платформе для кодирования даты и времени .
Да, явный семантический баг, влияющий на производительность, в функции StructToTime()
В качестве временного решения для добавления оптимизированной функции StructToTime() к существующим экспертам и индикаторам, которые активно используют эту функцию, это может быть сделано с минимальными изменениями кода:
StructToTime.mqh
ваш существующий код:
some codes from this webpage source code
Спасибо, интересный исходник.
I was able to devise a very fast function to get year, month and day of year.
Отлично, что собрали лучшие решения воедино. Небольшое ускорение.
В качестве временного решения для добавления оптимизированной функции StructToTime() к существующим экспертам и индикаторам, которые активно используют эту функцию, это может быть сделано с минимальными изменениями кода:
Почему не стали использовать CreateDateTime6?
Наверное, имеет смысл сделать временное решение и для TimeToStruct.
Почему они не использовали CreateDateTime6?