Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should initialize the ScriptEngine beforehand #7

Open
MatthieuNICOLAS opened this issue Sep 27, 2016 · 1 comment
Open

Should initialize the ScriptEngine beforehand #7

MatthieuNICOLAS opened this issue Sep 27, 2016 · 1 comment

Comments

@MatthieuNICOLAS
Copy link
Member

When a user submit some Python/Blockly code, the judge currently needs to initialize the ScriptEngine before being able to actually run the program, which takes a few seconds.

Since we reduced the execution's duration to 3 seconds before a timeout occurs, we now reach it everytime when running Python code.

We can increase the duration's limit in case of the programming language is Python or Blockly to get around this issue, but it would be better to initialize the Script Engine at startup or to reduce the time it takes to initialize it.

@mquinson
Copy link
Member

The first time we execute a script, we need to load all the corresponding classes, which takes a lot of time, and also to define some binding stuff in the python world, which is rather fast.
So, one solution would be to execute any python script at startup to actually load all the jars. The bindings can be rebuild each time, it won't take long.

I would say that the problem also exist for scala, at least partially. So here to we'd gain in performance by preloading the classes.

The clean way to do so could be to add a preload() method in each ProgrammingLanguage, in which each subclass does what it needs to fill the class loader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants