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

Does node-runner use the same node instance? #4

Open
aspirisen opened this issue Apr 18, 2024 · 3 comments
Open

Does node-runner use the same node instance? #4

aspirisen opened this issue Apr 18, 2024 · 3 comments

Comments

@aspirisen
Copy link

Hello, I am interested if node-runner reuse the node instance between functions run?

# node is running and waiting for input?
runner = NodeRunner.new(
  <<~JAVASCRIPT
    const hello = (response) => {
      return `Hello? ${response}`
    }
  JAVASCRIPT
)

And do not bootstrap node on every function call

# These functions call do not launch node every time
runner.hello "Goodbye!"
runner.hello "Goodbye! 2"
@aspirisen aspirisen changed the title Does node-runner uses the same node instance? Does node-runner use the same node instance? Apr 18, 2024
@jaredcwhite
Copy link
Member

jaredcwhite commented Apr 18, 2024

@aspirisen There's no persistent process, it's a single execution to get the response back.

@aspirisen
Copy link
Author

@jaredcwhite that mens that every time I call a function on runner - then new nodejs process has to bootstrap again, I think that can have affect performance.

Would you consider such new feature?

@jaredcwhite
Copy link
Member

@aspirisen So the persistent side process concept was a feature of https://github.com/bridgetownrb/bridgetown-lit-renderer, so I have a bit of an idea how it could work. I don't have any time to work on this for the time being, but if you want to work on something (and maybe that Lit plugin can help) for a PR, happy to review!

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