On Mon 29 Jul 2013 10:43:27 AM PDT, Brendan Eich wrote:
> Steve Fink wrote:
>> It tickles my innate premature optimization kneejerk
>> reaction, though.
>
> I know this was in context of "fair enough" and "I think you're
> right", but I LOL'ed here -- c'mon, C Python! It is way underoptimized
> compared to JS VMs.

Uh, yeah. I did feel a bit guilty writing that when I had just compared 
to Python's tuples, which are almost certainly worse for performance in 
all possible ways. In my defense, I was also comparing to Perl, which 
puts multiple return values on the stack.

> BTW destructuring plus array return should be optimized to erase the
> allocation and use the stack instead. E.g.,
>
>   function pair(a, b) { return [a, b]; }
>   let [x, y] = pair(z, w);
>
> should not allocate a fresh array in pair. Anyone know whether there's
> a bug asking for this?

I don't know of a bug, but then, I wouldn't. (I don't even know that we 
don't already do this.)

This is what I was referring to when I said it would require inlining, 
though. And in my case, the pair() function does a bunch of 
computation, including several loops, before returning (or yielding). 
Which probably means it won't be considered for inlining.

Unless you're thinking of a more general optimization?

_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to