Skip to content

Commit

Permalink
cmd/seb benchmark: generate random batch data once
Browse files Browse the repository at this point in the history
  • Loading branch information
micvbang committed Jul 10, 2024
1 parent 76ee866 commit e02105a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cmd/seb/app/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,22 +268,22 @@ func generateBatches(log logger.Logger, batches chan<- recordBatch, numBatches i
randSource := rand.New(rand.NewSource(1))
batchSize := recordsPerBatch * recordSize

for range numBatches {
records := make([]byte, batchSize)
n, err := randSource.Read(records)
if err != nil {
log.Fatalf("failed to generate random data: %s", err)
}
records := make([]byte, batchSize)
n, err := randSource.Read(records)
if err != nil {
log.Fatalf("failed to generate random data: %s", err)
}

if n != len(records) {
log.Fatalf("expected to generate %d bytes, got %d", len(records), n)
}
if n != len(records) {
log.Fatalf("expected to generate %d bytes, got %d", len(records), n)
}

recordSizes := make([]uint32, recordsPerBatch)
for i := range recordsPerBatch {
recordSizes[i] = uint32(recordSize)
}
recordSizes := make([]uint32, recordsPerBatch)
for i := range recordsPerBatch {
recordSizes[i] = uint32(recordSize)
}

for range numBatches {
batches <- recordBatch{
recordSizes: recordSizes,
records: records,
Expand Down

0 comments on commit e02105a

Please sign in to comment.