From af0bd02f095b09d1f341969f10ad87f7df7f5e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?NickKolok=20aka=20=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0?= =?UTF-8?q?=D0=B9=20=D0=90=D0=B2=D0=B4=D0=B5=D0=B5=D0=B2?= Date: Mon, 19 Jun 2017 21:25:01 +0300 Subject: [PATCH 1/3] Bumped benchmarked version (otherwise didn't work) --- benchmark/index.js | 2 +- package.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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" } } From 34566da2f35aa30a9fcec48d6b4b197daeda4acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?NickKolok=20aka=20=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0?= =?UTF-8?q?=D0=B9=20=D0=90=D0=B2=D0=B4=D0=B5=D0=B5=D0=B2?= Date: Mon, 19 Jun 2017 21:26:00 +0300 Subject: [PATCH 2/3] Simple (and a bit faster) modification of while --- benchmark/code/while-hash-in.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 benchmark/code/while-hash-in.js 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; +}; From 275feb5a0daea4f6fc6a66f1a58cd02a3a02cf7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?NickKolok=20aka=20=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0?= =?UTF-8?q?=D0=B9=20=D0=90=D0=B2=D0=B4=D0=B5=D0=B5=D0=B2?= Date: Mon, 19 Jun 2017 21:26:33 +0300 Subject: [PATCH 3/3] Tests to indicate current functions --- benchmark/code/actual-using-immutable.js | 3 +++ benchmark/code/actual-using.js | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 benchmark/code/actual-using-immutable.js create mode 100644 benchmark/code/actual-using.js 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