While loop - extremely slow?
#1

I am using a while loop to search in a array, with strfind... e.g:

PHP Code:
new myarray[MAX_MESSAGES][7][1000] =
{
    {
"hey""Hello, how are"},
    {
"hi""Hello , how are "}
}; 
Command:

PHP Code:
while(count != MAX_MESSAGES)
    {
        new 
Index getIndex();
        
printf("%d",count);
        
count++;
        
printf("%d",Index);
        if(
strfind(myarray[Index][0], texttrue)!=-1)
        {
            
printf("Found it");
            
Index;
            
found true;
            break;
        }    
        else
        {
            
printf("didnt find it");
            
found false;
        }
    } 
Basically that runs the loop until we're at MAX_MESSAGES, but breaks if we found what we're looking for.

I have approx 330 messages (MAX_MESSAGES), using that cmd, it takes around 3-4 second to get response, is it cuz of while, strfind or something else?
Reply


Messages In This Thread
While loop - extremely slow? - by iLearner - 08.02.2017, 18:58
Re: While loop - extremely slow? - by NaS - 08.02.2017, 19:09
Re: While loop - extremely slow? - by iLearner - 08.02.2017, 19:36
Re: While loop - extremely slow? - by NaS - 08.02.2017, 21:35
Re: While loop - extremely slow? - by iLearner - 08.02.2017, 22:00
Re: While loop - extremely slow? - by NaS - 08.02.2017, 23:25
Re: While loop - extremely slow? - by Lordzy - 09.02.2017, 01:02
Re: While loop - extremely slow? - by iLearner - 09.02.2017, 17:24
Re: While loop - extremely slow? - by NaS - 09.02.2017, 19:16
Re: While loop - extremely slow? - by iLearner - 09.02.2017, 22:02

Forum Jump:


Users browsing this thread: 1 Guest(s)