@@ -20,7 +20,7 @@ import (
2020 "github.com/hyperledger/fabric-x-committer/utils"
2121)
2222
23- func BenchmarkMapBlock (b * testing.B ) {
23+ func BenchmarkMapOneBlock (b * testing.B ) {
2424 flogging .ActivateSpec ("fatal" )
2525 txs := workload .GenerateTransactions (b , nil , b .N )
2626 block := workload .MapToOrdererBlock (1 , txs )
@@ -31,9 +31,12 @@ func BenchmarkMapBlock(b *testing.B) {
3131 b .StopTimer ()
3232 require .NoError (b , err , "This can never occur unless there is a bug in the relay." )
3333 require .NotNil (b , mappedBlock )
34- flogging .Init (flogging.Config {LogSpec : "fatal" })
34+ }
35+
36+ func BenchmarkMapBlockSize (b * testing.B ) {
37+ flogging .ActivateSpec ("fatal" )
3538 for _ , blockSize := range []int {100 , 1000 , 5000 , 10000 } {
36- b .Run (fmt .Sprintf ("txs =%d" , blockSize ), func (b * testing.B ) {
39+ b .Run (fmt .Sprintf ("blockSize =%d" , blockSize ), func (b * testing.B ) {
3740 // Generate b.N total TXs so each iteration processes a unique block,
3841 // avoiding cache/locality effects from reusing the same block.
3942 // Pad to ensure at least one full block.
@@ -62,7 +65,7 @@ func BenchmarkMapBlock(b *testing.B) {
6265 }
6366 blockIdx ++
6467 }
65- b .ReportMetric (float64 (b .N * blockSize )/ b .Elapsed ().Seconds (), "tx/s" )
68+ b .ReportMetric (float64 (b .N )/ b .Elapsed ().Seconds (), "tx/s" )
6669 })
6770 }
6871}
0 commit comments