Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dbnode] Decode perf time ops #2176

Merged
merged 89 commits into from
Mar 4, 2020
Merged

[dbnode] Decode perf time ops #2176

merged 89 commits into from
Mar 4, 2020

Conversation

rallen090
Copy link
Collaborator

@rallen090 rallen090 commented Feb 26, 2020

What this PR does / why we need it:

Decode operation optimizations such as changing time.Time to int64 operations. The 4 rightmost pink blocks are time operations, each ~10ms, which have been removed.
image

Speed improvements look to be about +22%

Master
BenchmarkNextIteration/series_2000-12                210           5555359 ns/op
BenchmarkNextIteration/series_2000-12                194           5877416 ns/op
BenchmarkNextIteration/series_2000-12                216           5561167 ns/op
BenchmarkNextIteration/series_2000-12                214           5574842 ns/op

All changes
BenchmarkNextIteration/series_2000-12                273           4294894 ns/op
BenchmarkNextIteration/series_2000-12                267           4312589 ns/op
BenchmarkNextIteration/series_2000-12                277           4481239 ns/op
BenchmarkNextIteration/series_2000-12                261           4534195 ns/op

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:


Does this PR require updating code package or user-facing documentation?:


@rallen090 rallen090 changed the base branch from master to r/trace-decode-time February 26, 2020 19:11
src/x/time/unit.go Outdated Show resolved Hide resolved
src/x/time/unit.go Outdated Show resolved Hide resolved
src/x/time/unit.go Outdated Show resolved Hide resolved
src/x/time/unit.go Outdated Show resolved Hide resolved
return nil, false
}

scheme := s[u]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth checking that 0 <= u < len(s) or is that being a bit too defensive?

Copy link
Collaborator Author

@rallen090 rallen090 Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah - I'm also not totally sure. We always new the schemes array via newTimeEncodingSchemes which ensures the array is size of unitCount, which means we know u will be valid in it. But since technically TimeEncodingSchemes could be created manually maybe it is safest to just check to be especially safe against an invalid index err.

Copy link
Collaborator

@arnikola arnikola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM /w 2 small nits

@rallen090 rallen090 merged commit 987db51 into master Mar 4, 2020
@arnikola arnikola deleted the ra/decode-perf-time-ops branch March 4, 2020 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants