pokt-network / smt

A Go library that implements a Sparse Merkle Trie for a key-value map.
https://pkg.go.dev/github.com/pokt-network/smt
Other
16 stars 4 forks source link

feat: add benchmarking suite #25

Closed h5law closed 1 year ago

h5law commented 1 year ago

Description

Summary generated by Reviewpad on 26 Sep 23 07:27 UTC

This pull request includes the following changes:

  1. The Makefile has been modified to add several targets and their corresponding commands. The new targets are: help, list, test_all, benchmark_all, benchmark_smt, benchmark_smt_fill, benchmark_smt_ops, benchmark_smst, benchmark_smst_fill, and benchmark_smst_ops. Each target has a description comment above its definition.

  2. The file diff adds two test functions: "TestSMT_ProofSizes" and "TestSMST_ProofSizes". These tests create a sparse Merkle tree and perform various operations on it. The tests calculate and log the average, minimum, and maximum sizes of serialized proofs and compacted proofs for different tree sizes ranging from 100,000 to 10,000,000.

  3. The file "bench_test.go" has been deleted. It used to contain benchmark functions for updating and deleting data in a Sparse Merkle Tree. These benchmarks relied on a Key-Value Store and utilized the "testing" package. The functions performed operations such as updating and deleting data using the Sparse Merkle Tree. The benchmarking logic included timing and memory allocation measurements. The Key-Value Store was stopped at the end of each benchmark.

  4. A new file called "bench_utils_test.go" has been introduced in the "benchmarks" package. The file contains benchmarking functions for the "smt" package and the "smst" package. It also includes helper functions for setting up the data structures and benchmarking functions for them. Overall, this file provides testing and benchmarking capabilities for the "smt" and "smst" packages.

  5. Changes have been made to the ".gitignore" file to ignore the ".idea/" directory and remove the "testdata/" directory from being ignored.

  6. The .github/workflows/test.yml file has been modified. Specifically, the run section of the Create coverage report and run tests job has been updated. Additionally, a new condition has been added to the Sanitize test results step.

  7. The file "bench_leaf_test.go" has been modified to add two benchmark test functions: "BenchmarkSMTLeafSizes_Fill" and "BenchmarkSMSTLeafSizes_Fill". These benchmarks test the performance of filling a sparse Merkle tree with different sizes of leaves. They use different objects and parameters for the tree update operation.

Please let me know if you need further assistance with this diff!

Issue

Fixes #9

Type of change

Please mark the relevant option(s):

List of changes

Testing

Required Checklist

If Applicable Checklist

codecov[bot] commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (1df1f48) 84.77% compared to head (3c0330e) 84.77%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #25 +/- ## ======================================= Coverage 84.77% 84.77% ======================================= Files 8 8 Lines 1241 1241 ======================================= Hits 1052 1052 Misses 138 138 Partials 51 51 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.