Small FlatMap optimization with default initialization
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失败的顾虑。
Side effects:
-
Performance effects(性能影响):
-
Breaking backward compatibility(向后兼容性):
Check List:
- Please make sure your changes are compilable(请确保你的更改可以通过编译).
- When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
- Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).
Because the usage difference with std::map, FlatMap is unfriendly to use. I think this PR is a good improvement.
There are some unknown crash issues. This PR will be opened after these issues are resolved.
@wwbmmm 有空看看
对FlatMap的性能有影响吗?
对FlatMap的性能有影响吗?
没有影响。理论上来说,内联的内存块对cache更优化。
LGTM
@javeme cc