← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #626564]: sikuli slows down to a crawl after running for some time

 

Question #626564 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/626564

geo gave more information on the question:
The mystery deepens. I put some timers so that I could see where in the program there is a slow down. There is something wrong that happens at the end of the while loop but only after this code has ran hundreds of times. Its really odd because I put the write to file line in the wrong spot so what I end up seeing or rather what I should end up seeing is the same value for the last two print lines. I should be seeing something like .....
      while loop time --> 0.22 
      after check position time --> 0.22 

But!! as you can see towards the end the "after check position time"
takes considerably longer than the  "while loop time" YET!!! they happen
right after each other. How do you explain that???


    #check if at least one egg exists
    if region1.exists(Pattern("1492966400130.png").similar(0.59),0):
        file.write("FOUND EGG\n")  #DEBUG
        foundEggTime = time.time()  #DEBUG

        while region1.exists(Pattern("1492966400130.png").similar(0.58),0):   
            startWhileTime = time.time()  #DEBUG
            file.write("-------EGG WHILE LOOP---------\n")  #DEBUG
            click(region1.getLastMatch()) # avoids another find() operation
            endWhileTime = time.time()  #DEBUG
            checkLastMouseLocation(Env.getMouseLocation())  
            endWhileTimeCheck = time.time()  #DEBUG
            file.write("    while loop time --> %.2f \n" % (endWhileTime - startWhileTime))
            file.write("    after check position time --> %.2f \n" % (endWhileTimeCheck - startWhileTime))

        finalTime = time.time()
        file.write("    ***exit found egg time --> %.2f \n" % (finalTime - foundEggTime))
        file.write("-------EXITING FOUND EGG--------\n")
        file.write("--------------------------------\n")

Here is the results print to file.


-------EGG WHILE LOOP---------
Mouse last location
checkRefresh
    while loop time --> 0.22 
    after check position time --> 0.22 
-------EGG WHILE LOOP---------
Mouse last location
checkRefresh
    while loop time --> 0.23 
    after check position time --> 0.23 
-------EGG WHILE LOOP---------
Mouse last location
checkRefresh
    while loop time --> 0.22 
    after check position time --> 0.22 
    ***exit found egg time --> 1.38 
-------EXITING FOUND EGG--------
--------------------------------
FOUND EGG
-------EGG WHILE LOOP---------
Mouse last location
checkRefresh
    while loop time --> 0.22 
    after check position time --> 0.22 
-------EGG WHILE LOOP---------
Mouse last location
checkRefresh
    while loop time --> 0.22 
    after check position time --> 0.22 
    ***exit found egg time --> 0.77  <--EXPECTED run time
-------EXITING FOUND EGG--------
--------------------------------
============================!!!!!!!!ELSE i.e FAIL!!!!!!!============================checkRefresh
HUNT AGAIN
get RARE egg/nMouse last location
checkRefresh
FOUND EGG
-------EGG WHILE LOOP---------
Mouse last location
checkRefresh
    while loop time --> 0.22 
    after check position time --> 3.23   <--- WHY IS THIS HAPPENING
-------EGG WHILE LOOP---------
Mouse last location
checkRefresh
    while loop time --> 0.22 
    after check position time --> 3.22 
-------EGG WHILE LOOP---------
Mouse last location
checkRefresh
    while loop time --> 0.22 
    after check position time --> 3.22

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.