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.
Based on benchmarks, running the destructor for all the objects in
BuildContext
takes 1-2% of the total time. Instead we can skip it entirely by extending the lifetime of this object until we callstd::_Exit
- ending the application and skipping destructing all objects on the stack.Using a
std::shared_ptr<void>
avoids us having to defineBuildContext
in the header file and bring in a load more include directives. Another alternative is to makeTrimUtil
instantiable and haveBuildContext
as a (perhaps pimple) member variable. However, this would require us to either reset all members inBuildContext
when we calltrim
, or to bantrim
being called multiple times. Neither are as easy as the current chosen solution - even if it is a bit strange.