I'm writing a low-level, CPU-bound parsing library, and I want to make sure 
the parsing code is as efficient as possible.

I know that V8 will sometimes inline function calls if they're "simple" 
enough, don't contain any blacklisted syntax, etc. 

But will it do the same with instance method calls? For example, let's say 
I just have a very simple wrapper like this:

class X {
    arr
    constructor(arr) {
       this.arr = arr
    }
    
    push(x) {
       this.arr.push(x)
    }
} 

Would a call like `x.push(1)` get inlined into `x.arr.push(1)`?

If so, what if I complicate things a bit:

   - If `push` instead calls another instance method. Would both calls get 
   inlined?
   - If it's an inherited method up the prototype chain (but is never 
   overriden)
   - If push calls a function in a variable, like if it received a function 
   argument and called it. Would the body of push get inlined even if the 
   internal call cannot be inlined? 
   

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/v8-users/b8183300-8c73-4a5b-9490-428328823ae2n%40googlegroups.com.

Reply via email to