-
Notifications
You must be signed in to change notification settings - Fork 157
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
Better handling of splat func arguments #857
Comments
I did a patch (summivox/LiveScript@e6591cf) but it currently relies on #859 being merged. It can be done without #859 but I'm too lazy 😉 This patch itself does not change any semantics -- the only change is inlining slicing of It works by inlining f = function(a){
var i$, b, res$, j$, c;
res$ = [];
for (j$ = 1 < (i$ = arguments.length - 1) ? 1 : (i$ = 1); j$ < i$; ++j$) {
res$.push(arguments[j$]);
}
b = res$; c = arguments[i$];
}; According to http://jsperf.com/arguments-to-array/43
However, as long as we get rid of deoptimization, the cost of a single slice should be negligible. Prealloc-assign is much harder to implement than list comprehension/empty-push. |
Ping @gkz (Babel and TypeScript do this by default, and CoffeeScript has been annoying people with the slow progress) |
@isiahmeadows : currently @vendethiel is in charge (and yes he did comment on that issue too). BTW: #859 has been merged, so I can actually make a pull request now. |
@summivox Okay. I didn't know this. (I don't keep up with this as much as I used to. LS 2.0 does seem pretty interesting, though.) |
According to Petka, calling
slice$
onarguments
kills v8 optimization. He suggested to do a naive indexed for loop onarguments
instead.Currently:
compiles to:
The text was updated successfully, but these errors were encountered: