Skip to content

Commit

Permalink
Remove not (yet) needed lines. Allow stampit to be slower than classe…
Browse files Browse the repository at this point in the history
…s 500 times instead of 50
  • Loading branch information
koresar committed Sep 15, 2019
1 parent c1a9a72 commit 35a7db1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -46,7 +46,7 @@ build/Release
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
.npmrc

package-lock.json


##### Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Expand Up @@ -11,3 +11,4 @@
/docs/
/src/
.npmrc
package-lock.json
2 changes: 0 additions & 2 deletions src/stampit.js
Expand Up @@ -49,7 +49,6 @@
for (; i < keys.length; i += 1) {
desc = getOwnPropertyDescriptor(src, keys[i]);
// Make it rewritable because two stamps can have same named getter/setter
desc.configurable = true;
defineProperty(dst, keys[i], desc);
}
}
Expand Down Expand Up @@ -101,7 +100,6 @@
}
} else { // nope, it looks like a getter/setter
// Make it rewritable because two stamps can have same named getter/setter
desc.configurable = true;
defineProperty(dst, key, desc);
}
}
Expand Down
7 changes: 4 additions & 3 deletions test/benchmark/object-create.js
Expand Up @@ -2,7 +2,7 @@
const test = require('tape');

const Benchmark = require('benchmark');
const stampit = require('../..'); // Need to test the distributable
const stampit = require('../../'); // Need to test the distributable


test('benchmarking object creation', (t) => {
Expand Down Expand Up @@ -83,8 +83,9 @@ test('benchmarking object creation', (t) => {
results.push(String(event.target));
})
.on('complete', function () {
t.ok(this[0].hz / this[1].hz >= 0.02,
'creating a stamp should be less than 50 times slower, not more');
const MAX = 500;
t.ok(this[0].hz / this[1].hz >= 1 / MAX,
`creating a stamp should be less than ${MAX} times slower, but was ${this[1].hz / this[0].hz}`);
t.comment(results.join('. '));
t.end();
})
Expand Down

0 comments on commit 35a7db1

Please sign in to comment.