-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: clean up MVCC key encoding functions
In particular, this separates the timestamp encoding from the overall key encoding. This is necessary for the MVCC range tombstone work, where Pebble key suffixes (timestamps) are processed in isolation. Unfortunately, this adds ~9% overhead for `EncodeMVCCKey()`. This was found to be due to additional function call overhead, and the Go compiler's unwillingness to inline these. This was considered acceptable for the encode path, while with the hotter `DecodeMVCCKey()` path the timestamp decoding logic was instead duplicated to avoid this overhead. ``` name old time/op new time/op delta EncodeMVCCKey/key=empty/ts=empty-24 15.8ns ± 0% 15.7ns ± 0% -0.46% (p=0.000 n=10+10) EncodeMVCCKey/key=empty/ts=walltime-24 17.9ns ± 0% 19.5ns ± 0% +8.88% (p=0.000 n=10+10) EncodeMVCCKey/key=empty/ts=walltime+logical-24 18.5ns ± 0% 20.1ns ± 0% +8.99% (p=0.000 n=10+10) EncodeMVCCKey/key=empty/ts=all-24 18.8ns ± 0% 20.4ns ± 0% +8.66% (p=0.000 n=10+10) EncodeMVCCKey/key=short/ts=walltime+logical-24 19.1ns ± 0% 20.7ns ± 0% +8.38% (p=0.000 n=10+9) EncodeMVCCKey/key=short/ts=all-24 19.5ns ± 0% 20.7ns ± 0% +6.18% (p=0.000 n=10+9) EncodeMVCCKey/key=short/ts=empty-24 16.3ns ± 0% 16.0ns ± 0% -1.86% (p=0.000 n=10+10) EncodeMVCCKey/key=short/ts=walltime-24 18.1ns ± 0% 20.6ns ± 0% +13.41% (p=0.000 n=8+8) EncodeMVCCKey/key=long/ts=empty-24 58.7ns ± 0% 58.8ns ± 0% +0.15% (p=0.000 n=10+10) EncodeMVCCKey/key=long/ts=walltime-24 59.8ns ± 0% 60.8ns ± 0% +1.78% (p=0.000 n=10+9) EncodeMVCCKey/key=long/ts=walltime+logical-24 60.7ns ± 0% 61.7ns ± 0% +1.54% (p=0.000 n=10+10) EncodeMVCCKey/key=long/ts=all-24 60.9ns ± 0% 61.9ns ± 0% +1.60% (p=0.000 n=10+9) DecodeMVCCKey/key=empty/ts=empty-24 12.4ns ± 0% 12.4ns ± 0% ~ (p=0.912 n=10+6) DecodeMVCCKey/key=empty/ts=walltime-24 13.3ns ± 0% 13.3ns ± 0% ~ (p=0.054 n=10+10) DecodeMVCCKey/key=empty/ts=walltime+logical-24 13.3ns ± 0% 13.3ns ± 0% -0.06% (p=0.034 n=10+10) DecodeMVCCKey/key=empty/ts=all-24 13.6ns ± 0% 13.6ns ± 0% ~ (p=0.509 n=10+10) DecodeMVCCKey/key=short/ts=walltime+logical-24 13.3ns ± 0% 13.3ns ± 0% ~ (all equal) DecodeMVCCKey/key=short/ts=all-24 13.6ns ± 0% 13.6ns ± 0% ~ (p=0.151 n=10+10) DecodeMVCCKey/key=short/ts=empty-24 12.5ns ± 0% 12.4ns ± 0% -0.21% (p=0.000 n=10+10) DecodeMVCCKey/key=short/ts=walltime-24 13.3ns ± 0% 13.3ns ± 0% ~ (p=0.577 n=8+10) DecodeMVCCKey/key=long/ts=walltime+logical-24 13.3ns ± 0% 13.3ns ± 0% ~ (all equal) DecodeMVCCKey/key=long/ts=all-24 13.6ns ± 0% 13.6ns ± 0% ~ (p=0.650 n=10+10) DecodeMVCCKey/key=long/ts=empty-24 12.4ns ± 0% 12.4ns ± 0% +0.15% (p=0.004 n=10+10) DecodeMVCCKey/key=long/ts=walltime-24 13.3ns ± 0% 13.3ns ± 0% +0.10% (p=0.012 n=10+9) ``` Release note: None
- Loading branch information
1 parent
25849d1
commit 9035872
Showing
3 changed files
with
341 additions
and
65 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
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.