bench: update and fix api and dependencies
This commit is contained in:
parent
375965c8a6
commit
2cfb73e019
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const BufferWriter = require('../lib/utils/writer');
|
const BufferWriter = require('bufio').BufferWriter;
|
||||||
const StaticWriter = require('../lib/utils/staticwriter');
|
const StaticWriter = require('bufio').StaticWriter;
|
||||||
const common = require('../test/util/common');
|
const common = require('../test/util/common');
|
||||||
const bench = require('./bench');
|
const bench = require('./bench');
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ const tx5 = common.readTX('tx5');
|
|||||||
tx.refresh();
|
tx.refresh();
|
||||||
const {size} = tx.getWitnessSizes();
|
const {size} = tx.getWitnessSizes();
|
||||||
const bw = new StaticWriter(size);
|
const bw = new StaticWriter(size);
|
||||||
tx.toWitnessWriter(bw);
|
tx.toWriter(bw);
|
||||||
bw.render();
|
bw.render();
|
||||||
}
|
}
|
||||||
end(10000);
|
end(10000);
|
||||||
@ -26,7 +26,7 @@ const tx5 = common.readTX('tx5');
|
|||||||
for (let i = 0; i < 10000; i++) {
|
for (let i = 0; i < 10000; i++) {
|
||||||
tx.refresh();
|
tx.refresh();
|
||||||
const bw = new BufferWriter();
|
const bw = new BufferWriter();
|
||||||
tx.toWitnessWriter(bw);
|
tx.toWriter(bw);
|
||||||
bw.render();
|
bw.render();
|
||||||
}
|
}
|
||||||
end(10000);
|
end(10000);
|
||||||
|
|||||||
@ -42,7 +42,7 @@ poly.init(key);
|
|||||||
for (let i = 0; i < 1000000; i++) {
|
for (let i = 0; i < 1000000; i++) {
|
||||||
poly.init(key);
|
poly.init(key);
|
||||||
poly.update(data);
|
poly.update(data);
|
||||||
poly.finish();
|
poly.final();
|
||||||
}
|
}
|
||||||
end(1000000 * 32 / 1024);
|
end(1000000 * 32 / 1024);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const CoinView = require('../lib/coins/coinview');
|
const CoinView = require('../lib/coins/coinview');
|
||||||
const BufferReader = require('../lib/utils/reader');
|
const BufferReader = require('bufio').BufferReader;
|
||||||
const StaticWriter = require('../lib/utils/writer');
|
const StaticWriter = require('bufio').StaticWriter;
|
||||||
const common = require('../test/util/common');
|
const common = require('../test/util/common');
|
||||||
const bench = require('./bench');
|
const bench = require('./bench');
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const merkle = require('bcrypto/lib/merkle');
|
const merkle = require('bcrypto/lib/merkle');
|
||||||
const random = require('bcrypto/lib/random');
|
const random = require('bcrypto/lib/random');
|
||||||
|
const SHA256 = require('bcrypto/lib/sha256');
|
||||||
const bench = require('./bench');
|
const bench = require('./bench');
|
||||||
|
|
||||||
const leaves = [];
|
const leaves = [];
|
||||||
@ -13,7 +14,7 @@ for (let i = 0; i < 3000; i++)
|
|||||||
{
|
{
|
||||||
const end = bench('tree');
|
const end = bench('tree');
|
||||||
for (let i = 0; i < 1000; i++) {
|
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(n);
|
||||||
assert(!m);
|
assert(!m);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -156,7 +156,7 @@ const mtx = new MTX();
|
|||||||
for (let i = 0; i < 100; i++) {
|
for (let i = 0; i < 100; i++) {
|
||||||
mtx.addInput({
|
mtx.addInput({
|
||||||
prevout: {
|
prevout: {
|
||||||
hash: consensus.NULL_HASH,
|
hash: consensus.ZERO_HASH,
|
||||||
index: 0
|
index: 0
|
||||||
},
|
},
|
||||||
script: new Script()
|
script: new Script()
|
||||||
|
|||||||
@ -37,7 +37,7 @@ const walletdb = new WalletDB({
|
|||||||
end(1000);
|
end(1000);
|
||||||
|
|
||||||
for (const addr of result)
|
for (const addr of result)
|
||||||
addrs.push(addr.receive.getAddress());
|
addrs.push(addr.receiveAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keys
|
// Keys
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user