New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to compile default parameters without usage of "arguments"? #1814

Closed
SkReD opened this Issue Jun 24, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@SkReD
Copy link

SkReD commented Jun 24, 2015

Generated code is not optimizing in v8 because of this

@sebmckbot

This comment has been minimized.

Copy link
Member

sebmckbot commented Jun 24, 2015

We have closed this issue as we've detected it to be a question. Please see the README:

For questions and support please visit the gitter room or StackOverflow. The Babel issue tracker is exclusively for bug reports and feature requests.

Thank you!

@sebmckbot sebmckbot closed this Jun 24, 2015

@kittens

This comment has been minimized.

Copy link
Contributor

kittens commented Jun 24, 2015

No it doesn't. Specific cases of arguments usage are optimised and this is one of them. No way to do default parameters without it since the arity shouldn't be changed.

@kpdecker

This comment has been minimized.

Copy link
Contributor

kpdecker commented Jun 25, 2015

(function(foo = 1){}).length === 0 certainly surprised me but I must admit the spec is a bit difficult for my mere mortal brain to comprehend :)
{edit} For those who may find this later, the behavior is defined here

Regardless this is a large performance impact, with up to 2000x performance hit.
image
http://kpdecker.github.io/six-speed/

Is this something that could be a candidate for a loose mode flag?

@kpdecker

This comment has been minimized.

Copy link
Contributor

kpdecker commented Jun 25, 2015

For magnitude, the Firefox operations per second are on the order of 833,518,046 operations/sec for ES5/6 and 452,602 operations/sec for Babel. Chrome is 80,841,415 vs. 7,336,055 so these potentially fall into the "good enough, just don't use on the hot path" category of code.

@lock lock bot added the outdated label Jul 15, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Jul 15, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.