Merge pull request #683 from braydonf/bench-updates

bench: update and fix api and dependencies
This commit is contained in:
Braydon Fuller 2019-03-01 09:19:19 -08:00
commit 4825ee66ef
No known key found for this signature in database
GPG Key ID: F24F232D108B3AD4
6 changed files with 11 additions and 10 deletions

View File

@ -1,7 +1,7 @@
'use strict';
const BufferWriter = require('../lib/utils/writer');
const StaticWriter = require('../lib/utils/staticwriter');
const BufferWriter = require('bufio').BufferWriter;
const StaticWriter = require('bufio').StaticWriter;
const common = require('../test/util/common');
const bench = require('./bench');
@ -14,7 +14,7 @@ const tx5 = common.readTX('tx5');
tx.refresh();
const {size} = tx.getWitnessSizes();
const bw = new StaticWriter(size);
tx.toWitnessWriter(bw);
tx.toWriter(bw);
bw.render();
}
end(10000);
@ -26,7 +26,7 @@ const tx5 = common.readTX('tx5');
for (let i = 0; i < 10000; i++) {
tx.refresh();
const bw = new BufferWriter();
tx.toWitnessWriter(bw);
tx.toWriter(bw);
bw.render();
}
end(10000);

View File

@ -42,7 +42,7 @@ poly.init(key);
for (let i = 0; i < 1000000; i++) {
poly.init(key);
poly.update(data);
poly.finish();
poly.final();
}
end(1000000 * 32 / 1024);
}

View File

@ -1,8 +1,8 @@
'use strict';
const CoinView = require('../lib/coins/coinview');
const BufferReader = require('../lib/utils/reader');
const StaticWriter = require('../lib/utils/writer');
const BufferReader = require('bufio').BufferReader;
const StaticWriter = require('bufio').StaticWriter;
const common = require('../test/util/common');
const bench = require('./bench');

View File

@ -3,6 +3,7 @@
const assert = require('assert');
const merkle = require('bcrypto/lib/merkle');
const random = require('bcrypto/lib/random');
const SHA256 = require('bcrypto/lib/sha256');
const bench = require('./bench');
const leaves = [];
@ -13,7 +14,7 @@ for (let i = 0; i < 3000; i++)
{
const end = bench('tree');
for (let i = 0; i < 1000; i++) {
const [n, m] = merkle.createTree(leaves.slice());
const [n, m] = merkle.createTree(SHA256, leaves.slice());
assert(n);
assert(!m);
}

View File

@ -156,7 +156,7 @@ const mtx = new MTX();
for (let i = 0; i < 100; i++) {
mtx.addInput({
prevout: {
hash: consensus.NULL_HASH,
hash: consensus.ZERO_HASH,
index: 0
},
script: new Script()

View File

@ -37,7 +37,7 @@ const walletdb = new WalletDB({
end(1000);
for (const addr of result)
addrs.push(addr.receive.getAddress());
addrs.push(addr.receiveAddress());
}
// Keys