-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: set default hasher to hashtree for benchmark
- Loading branch information
Showing
5 changed files
with
28 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { HashComputationLevel, getHashComputations } from "../../src/hashComputation"; | ||
import { executeHashComputations } from "../../src/hasher"; | ||
import { Node } from "../../src/node"; | ||
|
||
/** | ||
* This is only a test utility function, don't want to use it in production because it allocates memory every time. | ||
*/ | ||
export function batchHash(node: Node): void { | ||
const hashComputations: HashComputationLevel[] = []; | ||
getHashComputations(node, 0, hashComputations); | ||
executeHashComputations(hashComputations); | ||
if (node.h0 === null) { | ||
throw Error("Root node h0 is null"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Set the hasher to as-sha256 | ||
// Used to run benchmarks with with visibility into as-sha256 performance, useful for Lodestar | ||
// Set the hasher to hashtree | ||
// Used to run benchmarks with with visibility into hashtree performance, useful for Lodestar | ||
import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index.js"; | ||
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/as-sha256.js"; | ||
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/hashtree.js"; | ||
setHasher(hasher); |