node-runner icon indicating copy to clipboard operation
node-runner copied to clipboard

Does node-runner use the same node instance?

Open aspirisen opened this issue 1 year ago • 3 comments

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 avatar Apr 18 '24 09:04 aspirisen

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

jaredcwhite avatar Apr 18 '24 18:04 jaredcwhite

@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?

aspirisen avatar Apr 18 '24 19:04 aspirisen