Skip to content

Fix read next packet #14

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

Merged
merged 2 commits into from
Dec 3, 2014
Merged

Conversation

valnoel
Copy link

@valnoel valnoel commented Dec 3, 2014

Improve extracting process from InputFile

cchampet added a commit that referenced this pull request Dec 3, 2014
Avoid a copy of packet data when readNextPacket
@cchampet cchampet merged commit 4565048 into mikrosimage:develop Dec 3, 2014
if( ! _streamCache.empty() )
{
_streamCache.front().getBuffer().swap( data.getBuffer() );
_streamCache.erase( _streamCache.begin() );

Choose a reason for hiding this comment

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

"Because vectors use an array as their underlying storage, erasing elements in positions other than the vector end causes the container to relocate all the elements after the segment erased to their new positions. This is generally an inefficient operation compared to the one performed for the same operation by other kinds of sequence containers (such as list or forward_list)."

Use an std::queue instead.

Copy link
Author

Choose a reason for hiding this comment

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

Oh yes, indeed !

Copy link
Author

Choose a reason for hiding this comment

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

Done in PR #15

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.

3 participants