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

 
That's enough already.
 

I am searching for speeding up my functions, so I wondered how long it takes to access global variables and local variables is the same, so I made a script:

double H_global[1000],L_global[1000];
int start(){
   int i,j,start_local,start_global,GetTick;
   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];
      }
//---------------------
   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 = GetTickCount();
//---------------------   
   Print("локальный массив: " , GetTick-start_local , " миллисекунд.");
   Print("глобальный массив: ", GetTick-start_global, " миллисекунд.");
return(0);
}

my log is like this:

2012.03.23 13:26:49 test EURUSD,H1: global array: 1343 milliseconds.

2012.03.23 13:26:49 test EURUSD,H1: local array: 2703 milliseconds.

why is there such a difference? maybe i'm misjudging the variable access time?

 
And to think :)
 

Can anyone enlighten a dumbass why an order does not open ???

TESTER SAYS "LOG SAYS TRADE FLOW IS BUSY" ?

ORDERS OPEN BY HAND.

 
IgorM:

I am searching for speeding up my functions, so I wondered how long it takes to access global variables and local variables is the same, so I made a script:

my log is like this:

2012.03.23 13:26:49 test EURUSD,H1: global array: 1343 milliseconds.

2012.03.23 13:26:49 test EURUSD,H1: local array: 2703 milliseconds.

why is there such a difference? maybe i estimated the access time to the variables wrong?

double H_global[1000],L_global[1000];
int start(){
   int i,j,start_local,start_global,GetTick;
   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 = GetTickCount();
   Print("локальный массив: " , GetTick-start_local , " миллисекунд.");
//---------------------
   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 = GetTickCount();   
   Print("глобальный массив: ", GetTick-start_global, " миллисекунд.");
return(0);
}
 
TheXpert: And to think :)

Yeah, I've been sitting here for half an hour trying to figure out what I'm doing wrong, if I was in the habit of rubbing the back of my head with my hand, I'd have a bald head! )))))

But seriously, why does the script show such a big difference? If I had a Borland compiler, it would probably be the opposite, far calls may be explained, but MT4 works like the Java principle - everything in one pile?

Although it's not important, the principal thing is to find out if I estimate access time correctly, and if it is correct, then I will move half-code to global variables

 
VOLDEMAR:

Restarting the terminal should help. This is not a code problem.

 
IgorM:

Try it like this :)

   Print("локальный массив: " , start_global-start_local , " миллисекунд.");
   Print("глобальный массив: ", GetTick-start_global, " миллисекунд.");
 
Zhunko:
aaaaaaaaaaaaahhhh, shit! I was afraid it would take a long time to output via Print()
 
IgorM:
aaaaaaaaaaahhhh, shit! I was afraid it would take a long time to output via Print()

You can do it this way:

double H_global[1000],L_global[1000];
int start(){
   int i,j,start_local,start_global
,GetTickG,GetTickL;

;
   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];
      }
   GetTickL = 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];
      }
   GetTickG = GetTickCount();   
   Print("локальный массив: " , GetTickL-start_local , " миллисекунд.");
   Print("глобальный массив: ", GetTickG-start_global, " миллисекунд.");
return(0);
}
Reason: