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

Avoid frequent std::vector allocations #2

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

Conversation

dpelle
Copy link

@dpelle dpelle commented Sep 6, 2021

In my project, the most frequent dynamic allocations came from
std::vector in MinDistanceToLineSegment(...) and they can be
avoided by using a boost::container::small_vector which allocates
in the stack when there are fewer than N items. The sizeof items
is only 32 bytes, so having 64 items in small_vector uses only
2KB in the stack.

In my project, the most frequent dynamic allocations came from
std::vector in MinDistanceToLineSegment(...) and they can be
avoided by using a boost::container::small_vector which allocates
in the stack when there are fewer than N items. The sizeof items
is only 32 bytes, so having 64 items in small_vector uses only
2KB in the stack.
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.

1 participant