Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

various cleanups #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

various cleanups #3

wants to merge 9 commits into from

Conversation

lefticus
Copy link

Various cleanups for efficiency, including removing use of std::move, see notes. The use of std::move you had was actually causing the code to be potentially slower and was at the very least unnecessary.

@nbsdx this is worse than unnecesary, it prevents the compiler from
implement RVO and NRVO which are much more efficient than a move
operation.

See:

http://stackoverflow.com/questions/14856344/when-should-stdmove-be-used-on-a-function-return-value
Reduces 2-phase construction and more efficient in some cases, avoiding
object construction if not necessary
Technically this code is limiting the containers to 2B objects or less,
a more appropriate fix might be to return an appropriately signed
version of size_t
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant