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

Small FlatMap optimization with default initialization #2620

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chenBright
Copy link
Contributor

@chenBright chenBright commented Apr 27, 2024

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.(请遵循贡献者准则).

@chenBright chenBright force-pushed the opt_flat_map branch 7 times, most recently from d95b54c to b59d76d Compare April 27, 2024 16:58
@chenBright chenBright marked this pull request as draft April 27, 2024 17:04
@chenBright chenBright closed this Apr 27, 2024
@chenBright chenBright reopened this Apr 27, 2024
@chenBright chenBright force-pushed the opt_flat_map branch 3 times, most recently from 2556087 to dcdf77f Compare April 27, 2024 17:27
@chenBright chenBright closed this Apr 27, 2024
@javeme
Copy link

javeme commented May 22, 2024

Because the usage difference with std::map, FlatMap is unfriendly to use.
I think this PR is a good improvement.

@chenBright
Copy link
Contributor Author

There are some unknown crash issues. This PR will be opened after these issues are resolved.

@chenBright chenBright reopened this Jun 23, 2024
@chenBright chenBright force-pushed the opt_flat_map branch 13 times, most recently from 62db1f9 to 34a1429 Compare June 23, 2024 18:36
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.

2 participants