forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
122054: asof: optimize DatumToHLC when converting from strings r=yuzefovich a=yuzefovich See each commit for details. The combined effect on the newly-added benchmark is: ``` name old time/op new time/op delta DatumToHLC/stringTimestamp-24 684ns ± 0% 420ns ± 0% -38.51% (p=0.000 n=9+9) DatumToHLC/stringDecimal-24 12.0µs ± 0% 1.3µs ± 0% -89.48% (p=0.000 n=10+10) DatumToHLC/stringInterval-24 5.87µs ± 0% 2.97µs ± 0% -49.41% (p=0.000 n=10+10) name old alloc/op new alloc/op delta DatumToHLC/stringTimestamp-24 920B ± 0% 0B -100.00% (p=0.000 n=10+10) DatumToHLC/stringDecimal-24 2.98kB ± 0% 0.26kB ± 0% -91.40% (p=0.000 n=10+10) DatumToHLC/stringInterval-24 2.05kB ± 0% 0.66kB ± 0% -67.76% (p=0.000 n=10+10) name old allocs/op new allocs/op delta DatumToHLC/stringTimestamp-24 2.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10) DatumToHLC/stringDecimal-24 56.0 ± 0% 7.0 ± 0% -87.50% (p=0.000 n=10+10) DatumToHLC/stringInterval-24 28.0 ± 0% 18.0 ± 0% -35.71% (p=0.000 n=10+10) ``` Fixes: cockroachdb#121297. 122299: go.mod: bump Pebble to 26032dc0f80b r=RaduBerinde a=jbowens Changes: * [`26032dc0`](cockroachdb/pebble@26032dc0) internal/base: add MakeInternalKV * [`d01e5e99`](cockroachdb/pebble@d01e5e99) *: remove InternalKV.UserKey func * [`d253ff7b`](cockroachdb/pebble@d253ff7b) Configurable initial and max retained batch sizes * [`978bd26c`](cockroachdb/pebble@978bd26c) sstable: move empty block property logic to encoder/decoder * [`af7e51a3`](cockroachdb/pebble@af7e51a3) *: return *InternalKV from internal iterators Release note: none. Epic: none. Co-authored-by: Yahor Yuzefovich <[email protected]> Co-authored-by: Jackson Owens <[email protected]>
- Loading branch information
Showing
19 changed files
with
232 additions
and
101 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1683,10 +1683,10 @@ def go_deps(): | |
patches = [ | ||
"@com_github_cockroachdb_cockroach//build/patches:com_github_cockroachdb_pebble.patch", | ||
], | ||
sha256 = "f6d30631ba0ac55abbc0d06b4d28ae1d80df380cc88d0060df8cf188bdecd391", | ||
strip_prefix = "github.com/cockroachdb/[email protected]20240409231136-6cdb88d44473", | ||
sha256 = "67130f354fa38ef229503f8872696a5f2534636e5419f48e8ae04808565f9fce", | ||
strip_prefix = "github.com/cockroachdb/[email protected]20240412140635-26032dc0f80b", | ||
urls = [ | ||
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20240409231136-6cdb88d44473.zip", | ||
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20240412140635-26032dc0f80b.zip", | ||
], | ||
) | ||
go_repository( | ||
|
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,45 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package asof_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/settings/cluster" | ||
"github.com/cockroachdb/cockroach/pkg/sql/sem/asof" | ||
"github.com/cockroachdb/cockroach/pkg/sql/sem/eval" | ||
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree" | ||
"github.com/cockroachdb/cockroach/pkg/util/timeutil" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func BenchmarkDatumToHLC(b *testing.B) { | ||
evalCtx := eval.MakeTestingEvalContext(cluster.MakeTestingClusterSettings()) | ||
stmtTimestamp := timeutil.Now() | ||
usage := asof.AsOf | ||
|
||
for _, tc := range []struct { | ||
name string | ||
d tree.Datum | ||
}{ | ||
{name: "stringTimestamp", d: tree.NewDString("2024-04-09 12:00:00.000000")}, | ||
{name: "stringDecimal", d: tree.NewDString("1580361670629466905.0000000001")}, | ||
{name: "stringInterval", d: tree.NewDString("-5s")}, | ||
} { | ||
b.Run(tc.name, func(b *testing.B) { | ||
var err error | ||
for i := 0; i < b.N; i++ { | ||
_, err = asof.DatumToHLC(&evalCtx, stmtTimestamp, tc.d, usage) | ||
} | ||
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
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
Oops, something went wrong.