diff --git a/benchmark/code/actual-using-immutable.js b/benchmark/code/actual-using-immutable.js new file mode 100644 index 0000000..43d9b01 --- /dev/null +++ b/benchmark/code/actual-using-immutable.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../../index.js').immutable; \ No newline at end of file diff --git a/benchmark/code/actual-using.js b/benchmark/code/actual-using.js new file mode 100644 index 0000000..a0a1615 --- /dev/null +++ b/benchmark/code/actual-using.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../../index.js'); \ No newline at end of file diff --git a/benchmark/code/while-hash-in.js b/benchmark/code/while-hash-in.js new file mode 100644 index 0000000..e6129d8 --- /dev/null +++ b/benchmark/code/while-hash-in.js @@ -0,0 +1,16 @@ +'use strict'; + +module.exports = function(arr) { + var i = arr.length; + + var hash = Object.create(null); + var res = []; + + while (i--) { + if (!(arr[i] in hash)) { + hash[arr[i]] = true; + res.push(arr[i]); + } + } + return res; +}; diff --git a/benchmark/index.js b/benchmark/index.js index bbcac44..beed47e 100644 --- a/benchmark/index.js +++ b/benchmark/index.js @@ -2,7 +2,7 @@ var Suite = require('benchmarked'); var suite = new Suite({ - add: 'code/*.js', + code: 'code/*.js', fixtures: 'fixtures/*.js', cwd: __dirname }); diff --git a/package.json b/package.json index d87640a..d2c217b 100644 --- a/package.json +++ b/package.json @@ -58,5 +58,8 @@ "lint": { "reflinks": true } + }, + "dependencies": { + "benchmarked": "^1.1.1" } }