[2.1.0] Windows 8 in VM: Command line SikuliX slowness

Asked by Anup K on 2019-12-02

While using SikuliX from command line looks like slowness on startup the Surface automation activity.
Simple command line argument print taking time(approx 32 sec). I guess its from the framework startup time.

Command line script run command :
java -jar sikulix.jar <path-to-py>\commandLIne.py -- "1"

My SikuliX commandLine.py code:
import sys
print (sys.argv[1]) #it will print 1

Version details :
version using 2.1.0-SNAPSHOT

Time taking :
32s

Can you please let me know the reason of slowness or way to mitigate it.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2019-12-03
Last query:
2019-12-03
Last reply:
2019-12-02
RaiMan (raimund-hocke) said : #1

to run a script from commandline it must be:
java -jar sikulix.jar -r <path-to-py>\commandLIne.py -- "1"

(but it might be a typo here that the -r is missing)

tested on my Windows 10 system:
takes about 6 seconds until the 1 is printed to commandline

To get more info about what is going on use:

java -jar sikulix.jar -v -c -r <path-to-py>\commandLIne.py -- "1"

BTW: import sys is not needed in SikuliX scripts (already imported internally at script start)

RaiMan (raimund-hocke) said : #2

if you want to get the exact startup time until your script execution starts, add this as first line:

print "startup seconds:", time.time() - RUNTIME.getElapsedStart()/1000

RaiMan (raimund-hocke) said : #3

... on more thing:
In Python 2.x (which is the language level in SikuliX scripts) the print statement is used without brackets.
If you use brackets, the argument list will get a tuple.

Anup K (anupk) said : #4

Correct that was typo. Sorry for that. Find below verbose output . I am running on windows 8 . Still taking 27sec. Search with "Startup seconds :". Thanks again for your help.

----------------------------------------------------------------------------------------------------
E:\xxuser\SikuliXVer2.1.0-SNAPSHOT>java -jar sikulix.jar -v -c -r F:\xxuser2\SikuliX.sikuli\commandLine.sikuli\commandLine.py -- "1"

[DEBUG]startUp: IDE: Running: E:\xxuser\SikuliXVer2.1.0-SNAPSHOT\sikulix.jar

[DEBUG]startUp: IDE: AppData: E:\Users\xxuserid\AppData\Roaming\Sikulix

[DEBUG]startUp: IDE: starting

[DEBUG]startUp: IDE: no extensions.txt nor valid content

[DEBUG]startUp: IDE: adding extension: E:\Users\xxuserid\AppData\Roaming\Sikulix\Extensions\jruby-complete-9.2.0.0.jar

[DEBUG]startUp: IDE: adding extension: E:\Users\xxuserid\AppData\Roaming\Sikulix\Extensions\jython-standalone-2.7.1.jar

[826 debug] RunTime:temp folder ok: E:\Users\xxuserid\AppData\Local\Temp\23\Sikulix_983182427

Options: *** options dump

Options: testing =

Options: OptionsFile = E:\Users\xxuserid\AppData\Roaming\Sikulix\SikulixStore\SikulixOptions.txt

Options: *** options dump end

***** show environment for 2.1.0-SNAPSHOT-#459-2019-11-25_10:50 API

user.home: E:\Users\xxuserid

user.dir (work dir): E:\xxuser\SikuliXVer2.1.0-SNAPSHOT

user.name: xxuserid

java.io.tmpdir: E:\Users\xxuserid\AppData\Local\Temp\23

running 64Bit(amd64) on w (6.3) from a jar

java 8 version 1.8 vm 25.60-b23 class 52.0 arch 64

app data folder: E:\Users\xxuserid\AppData\Roaming\Sikulix

executing jar: E:\xxuser\SikuliXVer2.1.0-SNAPSHOT\sikulix.jar

*** classpath dump sikulix

  0: file:/E:/xxuser/SikuliXVer2.1.0-SNAPSHOT/sikulix.jar

*** classpath dump end

***** show environment end

[DEBUG]startUp: IDE: *********************** leaving start

[109 debug] Sikulix: starting IDE

[229 debug] RunTime:temp folder ok: E:\Users\xxuserid\AppData\Local\Temp\23\Sikulix_571798689

Options: *** options dump

Options: testing =

Options: OptionsFile = E:\Users\xxuserid\AppData\Roaming\Sikulix\SikulixStore\SikulixOptions.txt

Options: *** options dump end

***** show environment for 2.1.0-SNAPSHOT-#459-2019-11-25_10:50 API

user.home: E:\Users\xxuserid

user.dir (work dir): E:\xxuser\SikuliXVer2.1.0-SNAPSHOT

user.name: xxuserid

java.io.tmpdir: E:\Users\xxuserid\AppData\Local\Temp\23

running 64Bit(amd64) on w (6.3) from a jar

java 8 version 1.8 vm 25.60-b23 class 52.0 arch 64

app data folder: E:\Users\xxuserid\AppData\Roaming\Sikulix

executing jar: E:\xxuser\SikuliXVer2.1.0-SNAPSHOT\sikulix.jar

*** classpath dump sikulix

  0: file:/E:/xxuser/SikuliXVer2.1.0-SNAPSHOT/sikulix.jar

  1: file:/E:/Users/xxuserid/AppData/Roaming/Sikulix/Extensions/jruby-complete-9.2.0.0.jar

  2: file:/E:/Users/xxuserid/AppData/Roaming/Sikulix/Extensions/jython-standalone-2.7.1.jar

*** classpath dump end

***** show environment end

[7739 debug] Runner: added: Text [txt] text/text

[7780 debug] Runner: added: JRuby [rb] text/ruby

[7788 debug] Runner: added: NetworkRunner [] NET

[8832 debug] Runner: added: JavaScript [js] text/javascript

[8833 debug] Runner: added: Sikulix [] directory/sikulix

[8836 debug] Runner: added: SikulixJar [jar] text/jar

[8837 debug] Runner: added: PackedSikulix [skl] text/skl

[8839 debug] Runner: init: class org.sikuli.script.runners.AbstractLocalFileScriptRunner: warning: not possible

[8840 debug] Runner: added: PackedSikulix [zip] application/zip

[8842 debug] Runner: added: PowerShell [ps1] text/powershell

[8875 debug] Runner: added: Jython [py] text/jython

[8908 debug] init user preferences

[8916 debug] HotkeyManager: add Abort Hotkey: ALT+SHIFT C (67, 9)

[9506 debug] Runner: runscript: running script: F:\xxuser2\SikuliX.sikuli\commandLine.sikuli\commandLine.py

[9518 debug] JythonRunner: starting initialization

[9531 debug] RunTime:resourceLocation: (class org.sikuli.script.support.RunTime) /Lib/sikuli

[9533 debug] RunTime:resourceList: having jar: jar:file:/E:/xxuser/SikuliXVer2.1.0-SNAPSHOT/sikulix.jar!/Lib/sikuli

[11256 debug] RunTime:files exported: 7 from: Lib/sikuli to:

E:\Users\xxuserid\AppData\Roaming\Sikulix\Lib\sikuli

[21837 debug] Jython: added as Jython::sys.path[0]:

E:\Users\xxuserid\AppData\Roaming\Sikulix\Lib\site-packages

[21847 debug] Jython: ***** sys.path

0: E:\Users\xxuserid\AppData\Roaming\Sikulix\Lib\site-packages

1: E:\Users\xxuserid\AppData\Roaming\Sikulix\Lib

2: E:\Users\xxuserid\AppData\Roaming\Sikulix\Extensions\Lib

3: E:\Users\xxuserid\AppData\Roaming\Sikulix\Extensions\jython-standalone-2.7.1.jar\Lib

[22029 debug] JythonRunner: ready: version 2.7.1

[debug] Jython: SikulixForJython: init: starting

[debug] Jython: added as Jython::sys.path[0]:

E:\Users\xxuserid\AppData\Roaming\Sikulix\Lib\site-packages

[debug] Jython: SikulixForJython: init: success

[debug] Jython: sikuli: Sikuli: starting init

[debug] ScreenDevice 0 has (0,0) --- will be primary Screen(0)

[debug] Monitor 0: (0, 0) 1366 x 768

[debug] initMonitors: ended

[debug] Jython: use as default region: R[0,0 1366x768]@S(0)

[debug] Jython: sikuli: Sikuli: ending init

[debug] Jython: use as default region: R[0,0 1366x768]@S(0)

[debug] ImagePath: new BundlePath: F:\xxuser2\SikuliX.sikuli\commandLine.sikuli

Test

Startup seconds : 27.4949998856

1

[debug] HotkeyManager: reset: removed all SikuliX hotkeys.

[debug] HotkeyController: stopping hotkey provider

[debug] RunTime:***** final clexxuser2 at System.exit() *****

[debug] FileManager: deleteFileOrFolder:

E:\Users\xxuserid\AppData\Local\Temp\23\Sikulix_571798689

[30353 debug] RunTime:***** final clexxuser2 at System.exit() *****

[30414 debug] FileManager: deleteFileOrFolder:

E:\Users\xxuserid\AppData\Local\Temp\23\Sikulix_983182427

RaiMan (raimund-hocke) said : #5

It simply looks like a very slow system having <= 4GB.
The steps as shown in the debug log look regular.

You should at least upgrade to the latest Java 8 version (64-Bit).

With 2.1.0 nightly you might use the new server feature, to run scripts without startup delay:
https://github.com/RaiMan/SikuliX1/wiki/New-SikulixServer-Design

Anup K (anupk) said : #6

Its very high configuration dev environment. 128GB RAM.
I will try server option and let you know.
Server option making sense to me to start server first and initialize startup activities and run script on demand basis.

RaiMan (raimund-hocke) said : #7

--- Its very high configuration dev environment. 128GB RAM.
Then the slow startup does not make sense, if SikuliX is running in an environment without any restrictions.
What about I/O speed: during startup some stuff is loaded from disk or copied from jar to disk. Finally the Jython startup takes some time.

My Windows:
- latest Windows 10 64-bit
- latest Java 8
- Intel XEON E5-1650 v3
- 32 GB RAM
- SSD

... and as mentioned:
script starts after about 6 seconds.

Anup K (anupk) said : #8

Yeah got your point. Working on VM environment. I have to go through I/O speed details you asked for. It should
When I did SikulixServer option its working fast.(1/2sec) to run script.

But I am not finding any documentation for RUNTIME.getElapsedStart(). It giving wire outcome on context of elapsed timing at Server option but its definitely faster(approx1/2 sec can see it). I will do more debug and let you know.

Thank you very much for your quick reply and resolution approach.

Best RaiMan (raimund-hocke) said : #9

--- documentation for RUNTIME.getElapsedStart().
This is a function for internal use only and returns the time when the SikuliX runtime environment woke up.
It is comparable to time.time(), but the value is in milli-seconds.
Hence in the server context it does not make sense.

... but the script startup delay in the server context should indeed be only some 100 milliseconds.
It is comparable to running a script in the IDE, where the script run environment is completely initialised and reused.

Anup K (anupk) said : #10

Thanks RaiMan, that solved my question.