kv/batcheval: replace command hash-map with array#84108
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Jul 12, 2022
Merged
kv/batcheval: replace command hash-map with array#84108craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Member
d9e0201 to
77f1ddd
Compare
shralex
reviewed
Jul 9, 2022
Contributor
shralex
left a comment
There was a problem hiding this comment.
Reviewed 2 of 2 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @aayushshah15 and @nvanbenschoten)
pkg/kv/kvserver/batcheval/declare_test.go line 35 at r1 (raw file):
for i, command := range cmds { method := roachpb.Method(i)
nit: this can be moved after the "if"
shralex
approved these changes
Jul 9, 2022
aayushshah15
approved these changes
Jul 11, 2022
77f1ddd to
6015c6b
Compare
The per-request hash-map lookup showed up in CPU profiles while running
TPC-E:
```
----------------------------------------------------------+-------------
flat flat% sum% cum cum% calls calls% + context
----------------------------------------------------------+-------------
0.03s 60.00% | github.com/cockroachdb/cockroach/pkg/kv/kvserver.(*Replica).collectSpans github.com/cockroachdb/cockroach/pkg/kv/kvserver/pkg/kv/kvserver/replica_send.go:1093 (inline)
0.02s 40.00% | github.com/cockroachdb/cockroach/pkg/kv/kvserver.evaluateCommand github.com/cockroachdb/cockroach/pkg/kv/kvserver/pkg/kv/kvserver/replica_evaluate.go:483 (inline)
0 0% 0% 0.05s 0.029% | github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval.LookupCommand github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval/command.go:116
0.02s 40.00% | runtime.mapaccess2_fast64 GOROOT/src/runtime/map_fast64.go:57
0.02s 40.00% | runtime.mapaccess2_fast64 GOROOT/src/runtime/map_fast64.go:84
0.01s 20.00% | runtime.mapaccess2_fast64 GOROOT/src/runtime/map_fast64.go:69
----------------------------------------------------------+-------------
```
It's easy enough to get rid of by replacing the hash-map with
an array, like we do in other parts of the code.
6015c6b to
4a9816b
Compare
nvb
commented
Jul 12, 2022
Contributor
Author
nvb
left a comment
There was a problem hiding this comment.
TFTRs!
bors r+
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @shralex)
pkg/kv/kvserver/batcheval/declare_test.go line 35 at r1 (raw file):
Previously, shralex wrote…
nit: this can be moved after the "if"
Done.
Contributor
|
Build succeeded: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The per-request hash-map lookup showed up in CPU profiles while running TPC-E:
It's easy enough to get rid of by replacing the hash-map with an array, like we do in other parts of the code.