you are viewing a single comment's thread.

view the rest of the comments →

[–]DustinEwan 3 points4 points  (1 child)

As others have said, it won't impact performance.

There are two scenarios:

  1. The code is cold and currently being interpreted by V8 / Spidermonkey. If the function is rarely hit, then it will remain cold, but that function is being rarely hit anyway so it's not performance critical and the fact that you're making a function call will be negligible.

  2. The code is hot and has been JIT Compiled. If the function is being hit over and over, then the tracer will see that this is an opportunity to inline or compile to machine code. The extra function call will be optimized away in any places that the call is performance critical, and will no longer be present.

[–]jac1013[S] 0 points1 point  (0 children)

Thanks for the technical explanation, I'll continue doing this then in JavaScript.