Small FlatMap optimization with default initialization#2620
Merged
Conversation
d95b54c to
b59d76d
Compare
2556087 to
dcdf77f
Compare
|
Because the usage difference with std::map, FlatMap is unfriendly to use. |
Contributor
Author
|
There are some unknown crash issues. This PR will be opened after these issues are resolved. |
62db1f9 to
34a1429
Compare
410b67c to
0426dc9
Compare
96841c6 to
3ac6e31
Compare
3ac6e31 to
0077fa2
Compare
a3e0668 to
614f82e
Compare
614f82e to
2d31dbc
Compare
Contributor
Author
|
@wwbmmm 有空看看 |
Contributor
|
对FlatMap的性能有影响吗? |
Contributor
Author
没有影响。理论上来说,内联的内存块对cache更优化。 |
Contributor
|
LGTM |
Contributor
Author
|
@javeme cc |
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.
What problem does this PR solve?
Issue Number:
Problem Summary:
目前FlatMap需要二段式构造:构造函数+init函数。这种构造方式很容易用错,甚至出core,所以使用上必须小心翼翼,体验不好。
What is changed and the side effects?
Changed:
FlatMap构造函数结束即完成初始化。使用sso、IOBuf::SmallView的策略,初始化_buckets和_thumbnail使用内联的内存块,没有init函数中Alloc失败的顾虑。后续可以不用调init进行初始化,可以只在需要桶数比较大或者修改load factor才调init。即使init失败了,FlatMap还是可以正常使用的。
Side effects:
Performance effects(性能影响):
Breaking backward compatibility(向后兼容性):
Check List: