To speed up Sikuli execution, which would be better wait(sec) or exists(image,sec)?

Asked by Jeff Sant

I need to speed up my Sikuli script, as my script takes too much time while it opens a website and from that it moves to another and waits for the perticular option, though it is available on screen it clicks and wait.

So how to speed it up?

and

Which would be better wait(sec) or exists(image,sec)?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

-- wait(sec)
always waits the specified seconds.
If you want to wait for an image, use:
wait(image, sec)
which will constantly search for the image and return if found. If not found within the given time it ends the script with find failed.

-- exists(image,sec)
does the same as wait(image,sec), but does not throw FindFailed if not found. So it can be used in if/elif/else and while constructs.

*** speed up your script:
- never use wait(sec), always use exists(image,sec). But you need an image to wait for and guess a maximum waiting time.
- restrict the searches to smaller regions, which speeds up the find operation (up to ten times compared to large whole screen)

Find more hints in: faq https://answers.launchpad.net/sikuli/+faq/1607

Revision history for this message
Jeff Sant (sant-jeff) said :
#2

Thanks RaiMan, that solved my question.