Sign in to follow this  
Followers 0
ExElNeT

2D Array iteration slow

2 posts in this topic

Func equals($digit1, $digit2)   
    $count = UBound($digit1, 1) * UBound($digit1, 2)    
    $matches = 0
    For $y = 0 to 8 Step 1
        For $x = 0 to 5 Step 1
            If $digit1[$x][$y] = $digit2[$x][$y] Then
                $matches = $matches + 1
            EndIf
        Next
    Next        
    Return $matches * 100 / $count
EndFunc

This function takes 1 to 3 milli seconds to complete... This is way to slow for a 54 elements iteration. Is there anything i can do to speed up this method?

thanks in advance

Share this post


Link to post
Share on other sites



Func equals($digit1, $digit2)   
    $count = UBound($digit1, 1) * UBound($digit1, 2)    
    $matches = 0
    For $y = 0 to 8 Step 1
        For $x = 0 to 5 Step 1
            If $digit1[$x][$y] = $digit2[$x][$y] Then
                $matches = $matches + 1
            EndIf
        Next
    Next        
    Return $matches * 100 / $count
EndFunc

This function takes 1 to 3 milli seconds to complete... This is way to slow for a 54 elements iteration. Is there anything i can do to speed up this method?

thanks in advance

Code it in C++ or some other true compiled language. AutoIt is an interpreted scripting language, and slower speed is one of the prices for the simplicity and ease of use.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0