Howdy.

I was just reading through the Optimization Killers article on the Bluebird 
wiki 
<https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments>,
 
trying to work out whether the following would be optimized:

function get(/* ...k, j, i */) { 
   const a = arguments, l = a.length, n = l - 1
   switch (l) {
      case 0: return this
      case 1: return this[a[n]]
      default: return get.apply(this[a[a.length = n]], a) // a.length = n = 
a.length - 1
   }
}

console.log(get.call({x:{y:{z:'!!!'}}}, 'z','y','x')) // => "!!!"


Shedding an argument in this way isn't really discussed (anywhere that I 
can find), but it seems like it should be okay (at least it doesn't *appear* 
to be leaking).

Any insight would be highly appreciated. Thanks in advance!


-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to