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

Add support for compiling scripts & executing pre-compiled scripts. #119

Merged
merged 2 commits into from
Oct 8, 2021

Conversation

geoffreyharding
Copy link
Contributor

@geoffreyharding geoffreyharding commented Oct 5, 2021

Hi,
The goal of this change is to increase performance by precompiling the sanitized JS.
Use-case: an application which runs the same JS script many times, and requires low latency.

class Example
{
  NashornSandbox m_sandbox = NashornSandbox.create();
  CompiledScript m_precompiled = sandbox.compile("1 + 1");

  public int doSomething()
  {
     return (int)m_sandbox.eval(m_precompiled);
  }

@mxro
Copy link
Collaborator

mxro commented Oct 6, 2021

Thank you that looks great! Will have a closer look at this by next weekend the latest.

@mxro mxro merged commit bbe9689 into javadelight:master Oct 8, 2021
@mxro
Copy link
Collaborator

mxro commented Oct 8, 2021

Thank you for the PR - released with version 0.2.4 which should be available on Maven central soon!

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

Successfully merging this pull request may close these issues.

2 participants