Hey Robert,

It depends on the context: if your x is a property of the global object,
then V8 still optimizes Math.pow in your example. Even if it's a local
variable, we might still be able to optimize this in many cases.

But to answer your question: The polyfill assignment won't break the
optimizations.

HTH,
Benedikt

<[email protected]> schrieb am Mo., 18. Jan. 2016, 00:30:

> Hi v8-dev,
>
> I read somewhere the other day that
>
> y=Math.pow()
>
> is much faster than
>
> x=Math.pow
> y=x()
>
> because v8 can make a direct lookup of the symbol. I now wonder what
> happens with polyfills of newly arrived functions like Math.cosh:
>
> Math.cosh = Math.cosh || function(x) {
>     return (Math.exp(x) + Math.exp(-x)) / 2;
> };
>
> Is a polyfill breaking the optimization because the function was maybe
> labeled as changed or did you consider this somehow?
>
> Thanks Robert
>
> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" 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.
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" 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