← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #240935]: Large Test Batch (3000 test cases) gradually slows down in execution

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
-- Jython
yes Jython is fully OO: everything is an object, even functions.
The great advantage of language implementations like Jython, JRuby, Clojure, Scala, ..., is, that at every point in your script you can dive down to the Java level and use everything that Java offers. 
This is why Sikuli uses Jython as the top level scripting environment (JRuby and others will follow next year).
... but the Jython currently used is on the Python language level 2.5 (going to 2.7 with the next version) and many Python modules cannot be used with Jython, because they contain C-based parts. Only modules completely written in Python are useable.

-- your script
I cannot see any obvious reason for the slowdown. 

The only "flexible" parts are the wait-on-images. Since you use a max
wait time of 10 seconds in your example: do you suspect your app to take
some seconds to complete a GUI transition? If yes, are your sure that it
is not your app that slows down over the time? Having 26 of these waits
might sum up to some critical amount of elapsed time, if transition
takes longer.

Currently you do not have any profiling in your script. At some points in your script, you might add this:
start = time.time()
# some code
Result += "naming the point: %d msec\n"%(time.time()-start)

and get some timing information in your result doc.

-- threading
the following is the most basic implementation of a thread, where the main waits for the completion.

import thread
def thread_function(args, kwargs = None): 
# args is a list of values (might be your list Val)
# kwargs is a dictionary of key/value pairs) (optional)
   running = True
# here goes the payload of your loop, that deals with the test data given by Val
   running = False
   # the thread is closed here

# the following might be put into the csv-read-loop
running = False
thread.start_new_thread(thread_function, Val)
while not running: #waiting for start of thread
    wait(1)
while running: #waiting for the thread to end
    wait(1)

There is another module threading which allows much finer control over
threads running in parallel (thread pools).

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.