-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sstable: lazily allocate ValueFetcher
Currently the type `valueBlockReader` implements both `block.GetLazyValueForPrefixAndValueHandler` and `base.ValueFetcher`. The lifetime of the `ValueFetcher` needs to extend beyond that of the iterator. This commit splits it into two objects - `valueBlockReader` continues to implement `block.GetLazyValueForPrefixAndValueHandler` but the new `valueBlockFetcher` now implements `base.ValueFetcher`. The `valueBlockReader` lazily allocates the `valueBlockFetcher` the first time it is asked to produce a `LazyValue`. The result is that we should avoid the allocation if we are never positioned on a KV with non-in-place value (which is the norm when we get the latest version of a single key). ``` name old time/op new time/op delta RandSeekInSST/v4/single-level-10 691ns ± 2% 668ns ± 3% -3.38% (p=0.000 n=8+7) RandSeekInSST/v4/two-level-10 1.57µs ± 2% 1.54µs ± 4% ~ (p=0.067 n=7+8) RandSeekInSST/v5/single-level-10 479ns ± 1% 425ns ± 1% -11.28% (p=0.001 n=7+7) RandSeekInSST/v5/two-level-10 967ns ± 4% 868ns ± 4% -10.25% (p=0.001 n=7+7) name old alloc/op new alloc/op delta RandSeekInSST/v4/single-level-10 288B ± 0% 122B ± 2% -57.81% (p=0.000 n=8+8) RandSeekInSST/v4/two-level-10 288B ± 0% 122B ± 1% -57.74% (p=0.000 n=8+7) RandSeekInSST/v5/single-level-10 288B ± 0% 11B ± 0% -96.18% (p=0.000 n=8+7) RandSeekInSST/v5/two-level-10 288B ± 0% 11B ± 0% -96.18% (p=0.000 n=8+8) name old allocs/op new allocs/op delta RandSeekInSST/v4/single-level-10 1.00 ± 0% 0.00 -100.00% (p=0.000 n=8+8) RandSeekInSST/v4/two-level-10 1.00 ± 0% 0.00 -100.00% (p=0.000 n=8+8) RandSeekInSST/v5/single-level-10 1.00 ± 0% 0.00 -100.00% (p=0.000 n=8+8) RandSeekInSST/v5/two-level-10 1.00 ± 0% 0.00 -100.00% (p=0.000 n=8+8) ```
- Loading branch information
1 parent
405b4e1
commit 9cf3f64
Showing
5 changed files
with
140 additions
and
93 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
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