test speedup defensive

This commit is contained in:
Jörg Breitbart
2017-07-16 14:05:55 +02:00
parent ba2d0e8df2
commit 6733c6ce1f
+4 -2
View File
@@ -163,7 +163,7 @@ describe('wcwidth', () => {
assert.equal(wcwidth(0x30000), old_wcwidth(0x30000));
assert.equal(wcwidth(0x3fffe), old_wcwidth(0x3fffe));
});
it('new is at least 10 times faster', () => {
it('new is at least 5 times faster', () => {
let start_new = new Date().getTime();
let x = 0;
for (let runs = 0; runs < 1; ++runs)
@@ -176,6 +176,8 @@ describe('wcwidth', () => {
for (let i = 0; i < 65536; ++i)
y = old_wcwidth(i);
let end_old = new Date().getTime();
assert.equal(((end_new - start_new) * 10 < (end_old - start_old)), true);
//console.log((end_new - start_new));
//console.log((end_old - start_old));
assert.equal(((end_new - start_new) * 5 < (end_old - start_old)), true);
});
});