Testing the new MQL5 compiler for x64 platforms - 2 to 10 times faster calculations! - page 19

 
Aleksey Vyazmikin:

Hasthe profiler been suggested yet?

 
Aleksey Vyazmikin:

Option no. 2. Take each line of type:

if(Test_P==1000)if(DonProc<5.5 && Levl_Down_DC<-7.5) CalcTest=CalcTest+1; //(0.4810127 0.3037975 0.2151899)
                  if(Test_P==1001)if(DonProc< 5.5 && Levl_Down_DC>=-7.5 && TimeH< 21.5 && TimeH>=16.5 && TimeH< 19.5 && Levl_Close_H1s1N< 2.5) CalcTest=CalcTest+1; //(0.4400657 0.4072250 0.1527094)
                  if(Test_P==1002)if(DonProc< 5.5 && Levl_Down_DC>=-7.5 && TimeH< 21.5 && TimeH>=16.5 && TimeH< 19.5 && Levl_Close_H1s1N>=2.5) CalcTest=CalcTest+1; //(0.3739837 0.5121951 0.1138211)
                  if(Test_P==1003)if(DonProc<5.5 && Levl_Down_DC>=-7.5 && TimeH<21.5 && TimeH>=16.5 && TimeH>=19.5) CalcTest=CalcTest+1; //(0.3390706 0.4647160 0.1962134)

into a separate function. Try to believe Renate:)

I.e. the result should be like this in the end:

if(Test_P==1000 && Func1000()) CalcTest = CalcTest+1;
if(Test_P==1001 && Func1001()) CalcTest = CalcTest+1;
etc.
 
Aleksey Vyazmikin:

Yes, there's a link to the EA here.

It's been two days - the compilation is 7%...

'Tree_Brut_TestPL_F_Fast.mq5'
'Normal.mqh'
'Math.mqh'
code generated
0 error(s), 0 warning(s), 1456022 msec elapsed

On this machine.

2019.10.15 09:08:34.692 Terminal        Windows 10 (build 18362) x64, IE 11, UAC, Intel Xeon  E5-2630 v4 @ 2.20 GHz, Memory: 58760 / 65457 Mb, Disk: 20 / 224 Gb, GMT+2
 
Alexey Kozitsyn:

Hasthe profiler been offered yet?

No it hasn't - what exactly am I supposed to see in it? I don't really know how to use it.


Alexey Kozitsyn:

Option 2. To put each line of the type:

into a separate function. Try to believe Renate:)

I.e. the result should be so in the end:

etc.

It is the "case :" variant and not the "if" variant that gives a significant speed gain there. If you even make it like

               switch(Test_P)
                    {
                     case 1000: F1(); break;
                     case 1001: F2(); break;
                    }
   

The code will get even larger. But you may compare the compilation time and performance, of course...

 
Slava:

On this car.

Yeah that code isn't big, I haven't posted a 500 megabyte code - if you need it I can...

 
Aleksey Vyazmikin:

What other means do you suggest? This is the fastest option I've come up with so far...

Optimize the logic. For example, work with arrays and loops. Try to pack the criteria values into an array. And do checks in a loop. Maybe then there won't be a need in 74 thousand cases...

 
Aleksey Vyazmikin:

1. No they didn't - what exactly am I supposed to see in it? I don't really know how to use it.


2. it is the "case :" variant and not the "if" variant that gives a significant speed boost. If you even make it like

The code will get even faster... But you can certainly compare the compilation time and performance...

1. You will see the slowest parts of the code there. Although... Another question is whether it affects the compilation...

2. As you like: you can use case. You were advised to break it into smaller functions. Break it up and test it. Yes, of course, the code will get larger. But what to do.

 
@Renat Fatkhullin, please clarify, can the profiler help to reveal compilation bottlenecks? Or use it only to check code speed in real time?
 
Aleksey Vyazmikin:

I would transfer this enumeration, let's say, to external CSV file, but then another problem arises - waste of time to read the file, and besides, when handing out tasks to agents I am not able to send each agent 500 megabytes, while EA code is sent to one agent (or not?) and divided between them.

And another question, my code is easily compressed by 7zip from 500 to 15 megabytes, but after compression, the file will be around 500 - why is it so - no way to do primitive compression (at least up to 100 megabytes)?

Compress the file by zip. Read zip, decompress inside. It will be faster than transferring 500 Mb of EA (it is also transferred to each agent).

 
Alexey Kozitsyn:
@Renat Fatkhullin, could you please clarify, can the profiler help to reveal compilation bottlenecks? Or use it only to check code speed in real time?

The profiler has nothing to do with compilation.

Профилирование кода - Разработка программ - Справка по MetaEditor
Профилирование кода - Разработка программ - Справка по MetaEditor
  • www.metatrader5.com
Профилирование — это сбор характеристик программы во время ее выполнения. При профилировании замеряется время выполнения и количество вызовов отдельных функций и строк в коде программы. При помощи этого инструмента программист может найти наиболее медленные участки кода и провести их оптимизацию. Профилирование можно проводить на обычном...
Reason: