Any questions from a PROFI to a SUPER PROFI - 1. - page 35

 
I don't know about MQL4, but when I was running a race in C++, I noticed that the code you run first is slower than the second one. Surely, it takes time to allocate memory first. Usually 5% slower.
 
double H_global[1000],L_global[1000];
int start(){
   int i,j,start_local,start_global,GetTick_local,GetTick_global;
   double H_local[1000],L_local[1000];
   start_local=GetTickCount();
   for(j=0;j<10000;j++)
      for(i=0;i<1000;i++){
         H_local[i] = High[i];
         L_local[i] = Low[i];
      }
   GetTick_local = GetTickCount();
//---------------------
   start_global=GetTickCount();
   for(j=0;j<10000;j++)
      for(i=0;i<1000;i++){
         H_global[i] = High[i];
         L_global[i] = Low[i];
      }
   GetTick_global = GetTickCount();
//---------------------   
   Print("локальный массив: " , GetTick_local-start_local , " миллисекунд.");
   Print("глобальный массив: ", GetTick_global-start_global, " миллисекунд.");
return(0);
}

in the log:

2012.03.23 13:40:50 test EURUSD,H1: global array: 1406 milliseconds.

2012.03.23 13:40:50 test EURUSD,H1: local array: 1344 milliseconds.

now it makes sense: global variables take a bit longer, local ones faster; although I thought it didn't make any difference, I should measure it in the called function, maybe there is some other difference

 
IgorM:

in the log:

2012.03.23 13:40:50 test EURUSD,H1: global array: 1406 milliseconds.

2012.03.23 13:40:50 test EURUSD,H1: local array: 1344 milliseconds.

now it makes sense: global variables take a bit longer, local ones faster; although I thought it didn't make any difference, I should measure it in the called function, maybe there is some other difference

I guess if you swap them around, the results will stay the same.
 
Zhunko: I guess if you swap them around, the results will stay the same.

changed, and copied start() to func(), after prints start func() :

2012, 03.23 14:11:15 test EURUSD,H1: local array: 1313 milliseconds.

2012.03.23 14:11:15 test EURUSD,H1: global array: 1359 milliseconds.

2012.03.23 14:11:15 test EURUSD,H1: call function.....

2012.03.23 14:11:18 test EURUSD,H1: ph-action, local array: 1312 milliseconds.

2012.03.23 14:11:18 test EURUSD,H1: f-ction, global array: 1328 milliseconds.




 
IgorM:

changed, and copied start() to func(), after pprinnts start func() :

2012, 03.23 14:11:15 test EURUSD,H1: local array: 1313 milliseconds.

2012.03.23 14:11:15 test EURUSD,H1: global array: 1359 milliseconds.

2012.03.23 14:11:15 test EURUSD,H1: call function.....

2012.03.23 14:11:18 test EURUSD,H1: ph-action, local array: 1312 milliseconds.

2012.03.23 14:11:18 test EURUSD,H1: f-ction, global array: 1328 milliseconds.

Swapped global and local? Right now it's local first, then global. It should be the other way around.
 
IgorM:

changed, and copied start() to func(), after prints start func() :

2012, 03.23 14:11:15 test EURUSD,H1: local array: 1313 milliseconds.

2012.03.23 14:11:15 test EURUSD,H1: global array: 1359 milliseconds.

2012.03.23 14:11:15 test EURUSD,H1: call function.....

2012.03.23 14:11:18 test EURUSD,H1: ph-action, local array: 1312 milliseconds.

2012.03.23 14:11:18 test EURUSD,H1: f-ction, global array: 1328 milliseconds.

As a matter of speculation, the address of the local variable is counted from the function call point, the global variable address is counted from the program call point, i.e. in order to access the global variable, one more action (add an offset) must be performed.
 
Zhunko: Have you swapped the global and the local? Now the local one is first followed by the global one. I should have it reversed.

I did so, but the results did not change, and I also declared an array in a separate function, called the function and compared it to a global array call

alsu, that's quite a logical assumption, but my experiments have led me to a funny idea: mql4 is for lamers, you declare it the way you want, as they say in the game. ))). Maybe I'll make some experiments with mql5 if I don't forget, it's just discussing the performance of MT5, maybe something will become clear.

 

By any chance no one has ported FANN to mql? http://leenissen.dk/fann/wp/download/, or similar code to mql with NS.

ZS: I can't find a ready-made NS by search and google, I plugged a .dll with FANN, it works pretty well, but I would like it without .dll.

 
IgorM:

By any chance no one has ported FANN to mql? http://leenissen.dk/fann/wp/download/, or similar code to mql with NS.

ZS: I can't find a ready-made NS by search and google, I plugged a .dll with FANN, it works pretty well, but I would like it without .dll.


It is better to train network in specialized software. It is much faster. And it is better to use it in code
 
Vinin: It is better to train the network in specialised software. It is much faster. And it is better to use it in code
I know, but I really need it and ... I want to make an auto-optimizer in my Expert Advisor, without .dll :)