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

autovector: performance improves #10230

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

rockeet
Copy link
Contributor

@rockeet rockeet commented Jun 22, 2022

  1. use union values_ instead of point values_ point to internal buf_
    a. this reduces autovector object size
    b. this reduces a memory load for pointer value_
    c. this makes autovector relocatable(memmoveable) because there is no ptr point to object self
  2. rearrange fields for cpu cache friendly
  3. two exception-safe fix
  4. delete ~iterator_impl
  5. This PR also fix two bugs(operator= and assign) which old code may call operator= on uninitialized memory

1. use union values_ instead of point values_ point to internal buf_
2. rearrange fields for cpu cache friendly
3. two exception-safe fix
4. delete ~iterator_impl
value_type)) char buf_[kSize *
sizeof(value_type)]; // the first `kSize` items
pointer values_;
static void destory(value_type* p, size_t n) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be renamed to destroy (typo in previous method name).

Suggested change
static void destory(value_type* p, size_t n) {
static void destroy(value_type* p, size_t n) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks for your correction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants