Skip to content

Commit

Permalink
Merge pull request #17 from lightpanda-io/bench-history-scale
Browse files Browse the repository at this point in the history
Bench history scale
  • Loading branch information
krichprollsch authored Feb 2, 2024
2 parents 845a36c + 0c5d85a commit 6b5d468
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions bench/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ func parseLine(data []byte) (OutItem, error) {
if err != nil {
return OutItem{}, fmt.Errorf("bad data format: %w", err)
}
// The text duration is in microseconds but we want to convert it in
// nanoseconds for JSON.
duration *= 1000

reallocnb := 0
if len(b[4]) > 0 {
Expand All @@ -92,6 +95,9 @@ func parseLine(data []byte) (OutItem, error) {
if err != nil {
return OutItem{}, fmt.Errorf("bad data format: %w", err)
}
// The text aloc size is in KBytes but we want to conver it in Bytes for
// JSON.
allocsize *= 1024

return OutItem{
Duration: duration,
Expand Down
7 changes: 4 additions & 3 deletions cmd/history/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func run(ctx context.Context, args []string, stdout, stderr io.Writer) error {
res = append(res, out)
}

// pull hitory.json file
// pull history.json file
fio, err := s3.NewS3IO(env("AWS_BUCKET", AWSBucket), "bench/history.json")
if err != nil {
return fmt.Errorf("news3io single result: %w", err)
Expand All @@ -120,9 +120,10 @@ func run(ctx context.Context, args []string, stdout, stderr io.Writer) error {
// let merge all and res
APPEND:
for _, in := range res {
for _, a := range all {
for i, a := range all {
if in.Hash == a.Hash {
// the commit already exists in all
// the commit already exists in all we replace the values.
all[i] = in
continue APPEND
}
}
Expand Down

0 comments on commit 6b5d468

Please sign in to comment.