Permalink
Browse files

s/sys/util/

  • Loading branch information...
isaacs committed Nov 22, 2011
1 parent 5815d5c commit 9cfbb61b6fd46d980e43efb1808899855ec719aa
Showing with 40 additions and 32 deletions.
  1. +38 −30 examples/array-ify.js
  2. +2 −2 lib/bench.js
View
@@ -70,46 +70,54 @@ function sliceZeroApplyArg (x) {
return Array.prototype.slice.apply(arguments, [0])
}
+function arrayProto () {
+ arguments.__proto__ = Array.prototype
+ return arguments
+}
+
exports.compare =
{ manualMap: function () {
return [ manualMap(Math.random()), manualMap(Math.random(), Math.random()) ]
}
+ , arrayProto: function () {
+ return [ arrayProto(Math.random()), arrayProto(Math.random(), Math.random()) ]
+ }
, duff: function () {
return [ duff(Math.random()), duff(Math.random(), Math.random()) ]
}
- , manualMapArg: function () {
- return [ manualMapArg(Math.random()), manualMapArg(Math.random(), Math.random()) ]
- }
, arrayApply: function () {
return [ arrayApply(Math.random()), arrayApply(Math.random(), Math.random()) ]
}
- , arrayApplyArg: function () {
- return [ arrayApplyArg(Math.random()), arrayApplyArg(Math.random(), Math.random()) ]
- }
- , sliceCall: function () {
- return [ sliceCall(Math.random()), sliceCall(Math.random(), Math.random()) ]
- }
- , sliceCallArg: function () {
- return [ sliceCallArg(Math.random()), sliceCallArg(Math.random(), Math.random()) ]
- }
- , sliceZeroCall: function () {
- return [ sliceZeroCall(Math.random()), sliceZeroCall(Math.random(), Math.random()) ]
- }
- , sliceZeroCallArg: function () {
- return [ sliceZeroCallArg(Math.random()), sliceZeroCallArg(Math.random(), Math.random()) ]
- }
- , sliceApply: function () {
- return [ sliceApply(Math.random()), sliceApply(Math.random(), Math.random()) ]
- }
- , sliceApplyArg: function () {
- return [ sliceApplyArg(Math.random()), sliceApplyArg(Math.random(), Math.random()) ]
- }
- , sliceZeroApply: function () {
- return [ sliceZeroApply(Math.random()), sliceZeroApply(Math.random(), Math.random()) ]
- }
- , sliceZeroApplyArg: function () {
- return [ sliceZeroApplyArg(Math.random()), sliceZeroApplyArg(Math.random(), Math.random()) ]
- }
+ //, manualMapArg: function () {
+ // return [ manualMapArg(Math.random()), manualMapArg(Math.random(), Math.random()) ]
+ // }
+ //, arrayApplyArg: function () {
+ // return [ arrayApplyArg(Math.random()), arrayApplyArg(Math.random(), Math.random()) ]
+ // }
+ //, sliceCall: function () {
+ // return [ sliceCall(Math.random()), sliceCall(Math.random(), Math.random()) ]
+ // }
+ //, sliceCallArg: function () {
+ // return [ sliceCallArg(Math.random()), sliceCallArg(Math.random(), Math.random()) ]
+ // }
+ //, sliceZeroCall: function () {
+ // return [ sliceZeroCall(Math.random()), sliceZeroCall(Math.random(), Math.random()) ]
+ // }
+ //, sliceZeroCallArg: function () {
+ // return [ sliceZeroCallArg(Math.random()), sliceZeroCallArg(Math.random(), Math.random()) ]
+ // }
+ //, sliceApply: function () {
+ // return [ sliceApply(Math.random()), sliceApply(Math.random(), Math.random()) ]
+ // }
+ //, sliceApplyArg: function () {
+ // return [ sliceApplyArg(Math.random()), sliceApplyArg(Math.random(), Math.random()) ]
+ // }
+ //, sliceZeroApply: function () {
+ // return [ sliceZeroApply(Math.random()), sliceZeroApply(Math.random(), Math.random()) ]
+ // }
+ //, sliceZeroApplyArg: function () {
+ // return [ sliceZeroApplyArg(Math.random()), sliceZeroApplyArg(Math.random(), Math.random()) ]
+ // }
}
exports.countPerLap = 2
View
@@ -28,7 +28,7 @@ function runMain () {
}
var events = require("events")
- , sys = require("sys")
+ , util = require("util")
function run (fn, time, countPerLap, cb) {
time = time || exports.TIME
@@ -124,7 +124,7 @@ function randomArray (l) {
return knuth(a)
}
-function print (m,cr) { sys.print(m+(cr===false?"":"\n")); return print }
+function print (m,cr) { util.print(m+(cr===false?"":"\n")); return print }
function show (results) {
var averages = []

0 comments on commit 9cfbb61

Please sign in to comment.