-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add benchmarks and share commitment test (#1726)
Closes: celestiaorg/celestia-app#1717 --------- Co-authored-by: Rootul P <rootulp@gmail.com>
- Loading branch information
Showing
4 changed files
with
97 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package square_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/celestiaorg/celestia-app/pkg/appconsts" | ||
"github.com/celestiaorg/celestia-app/pkg/square" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func BenchmarkSquareConstruct(b *testing.B) { | ||
for _, txCount := range []int{10, 100, 1000} { | ||
b.Run(fmt.Sprintf("txCount=%d", txCount), func(b *testing.B) { | ||
txs := generateOrderedTxs(txCount/2, txCount/2, 1024) | ||
for i := 0; i < b.N; i++ { | ||
_, err := square.Construct(txs, appconsts.DefaultMaxSquareSize) | ||
require.NoError(b, err) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func BenchmarkSquareBuild(b *testing.B) { | ||
for _, txCount := range []int{10, 100, 1000, 10000} { | ||
b.Run(fmt.Sprintf("txCount=%d", txCount), func(b *testing.B) { | ||
txs := generateMixedTxs(txCount/2, txCount/2, 1024) | ||
for i := 0; i < b.N; i++ { | ||
_, _, err := square.Build(txs, appconsts.DefaultMaxSquareSize) | ||
require.NoError(b, err) | ||
} | ||
}) | ||
} | ||
} |
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