refactor: update pkg name

This commit is contained in:
cedoor
2022-01-17 21:58:15 +01:00
parent 05505547d7
commit 67d40fff3c
15 changed files with 44 additions and 42 deletions

View File

@@ -0,0 +1,39 @@
import b from "benny"
import { poseidon } from "circomlibjs"
import { IncrementalMerkleTree } from "../src"
import { IncrementalQuinTree } from "incrementalquintree"
const newTree = new IncrementalMerkleTree(poseidon, 20, BigInt(0), 2)
const oldTree = new IncrementalQuinTree(20, BigInt(0), 2, poseidon)
const numberOfLeaves = 2 ** 4
b.suite(
"Incremental Merkle tree benchmarks",
b.add("Generate proof for new tree", () => {
for (let i = 0; i < numberOfLeaves; i += 1) {
newTree.insert(BigInt(i + 1))
}
for (let i = 0; i < numberOfLeaves; i += 1) {
newTree.createProof(i)
}
}),
b.add("Generate proof for old tree", () => {
for (let i = 0; i < numberOfLeaves; i += 1) {
oldTree.insert(BigInt(i + 1))
}
for (let i = 0; i < numberOfLeaves; i += 1) {
oldTree.genMerklePath(i)
}
}),
b.cycle(),
b.complete(),
b.save({ file: "reduce", version: "1.0.0", details: true }),
b.save({ file: "reduce", format: "chart.html", details: true })
)

View File

@@ -26,6 +26,7 @@
},
"license": "MIT",
"scripts": {
"benchmark": "node -r ts-node/register benchmarks/index.ts",
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
"prepublishOnly": "yarn build"

View File

@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "tests", "benchmarks", "rollup.config.ts"]
}

View File

@@ -1,38 +0,0 @@
// const b = require("benny");
// const { poseidon } = require("circomlibjs");
// const { IncrementalMerkleTree } = require("../dist/types")
// const Tree = require("incrementalquintree/build/IncrementalQuinTree")
// const tree = new IncrementalMerkleTree(poseidon, 20, BigInt(0), 2)
// const old = new Tree.IncrementalQuinTree(20, BigInt(0), 2, poseidon)
// const numberOfLeaves = 2 ** 10;
// b.suite(
// 'incremental merkle tree benchmarks',
// b.add('generate proof for nary binary tree', () => {
// for (let i = 0; i < numberOfLeaves; i+=1) {
// tree.insert(BigInt(i + 1))
// }
// for (let i = 0; i < numberOfLeaves; i += 1) {
// tree.createProof(i)
// }
// }),
// b.add('generate proof for old binary tree', () => {
// for (let i = 0; i < numberOfLeaves; i+=1) {
// old.insert(BigInt(i + 1))
// }
// for (let i = 0; i < numberOfLeaves; i += 1) {
// old.genMerklePath(i)
// }
// }),
// b.cycle(),
// b.complete(),
// b.save({ file: 'reduce', version: '1.0.0', details: true }),
// b.save({ file: 'reduce', format: 'chart.html', details: true }),
// )

View File

@@ -1,4 +0,0 @@
{
"extends": "../../tsconfig.json",
"include": ["src", "tests", "rollup.config.ts", "benchmarks"]
}