Skip to content

Instantly share code, notes, and snippets.

@summivox
Last active February 20, 2016 23:10
Show Gist options
  • Save summivox/47cfa0947e855995c002 to your computer and use it in GitHub Desktop.
Save summivox/47cfa0947e855995c002 to your computer and use it in GitHub Desktop.
manage-arguments does NOT work
4.6.85.31
Function is not optimized
Function is not optimized
Function is not optimized
Function is optimized
npm i v8-natives manage-arguments
// Generated by LiveScript 1.4.0
(function(){
var v8, MA, S, fs, i$, len$, f, slice$ = [].slice;
v8 = require('v8-natives');
MA = require('manage-arguments');
S = function(it){
var i$, x$, len$, results$ = [];
for (i$ = 0, len$ = it.length; i$ < len$; ++i$) {
x$ = it[i$];
results$.push(x$);
}
return results$;
};
fs = [
function(){
var a;
a = slice$.call(arguments);
return a.sort();
}, function(){
var x;
x = MA(arguments);
return x.sort();
}, function(){
var x;
x = S(arguments);
return x.sort();
}, function(){
var x, res$, i$, x$, len$;
res$ = [];
for (i$ = 0, len$ = arguments.length; i$ < len$; ++i$) {
x$ = arguments[i$];
res$.push(x$);
}
x = res$;
return x.sort();
}
];
console.log(v8.getV8Version());
for (i$ = 0, len$ = fs.length; i$ < len$; ++i$) {
f = fs[i$];
v8.helpers.testOptimization(f);
}
}).call(this);
require! {
'v8-natives': v8
'manage-arguments': MA
}
S = -> [.. for it]
fs = [
(...a) -> a.sort!
->
x = MA arguments
x.sort!
->
x = S arguments
x.sort!
->
x = [.. for arguments]
x.sort!
]
console.log v8.getV8Version!
for f in fs => v8.helpers.testOptimization f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment