feat: implement window mechanism to eliminate memmove operations - #17
Open
yc199911 wants to merge 1 commit into
Open
feat: implement window mechanism to eliminate memmove operations#17yc199911 wants to merge 1 commit into
yc199911 wants to merge 1 commit into
Conversation
- Add 'start' field to pktbuf_t for window-based buffer management - Refactor pktbuf_is_complete() to use window offset instead of memmove - Refactor pktbuf_pop_packet() to use window offset instead of memmove - Maintain full backward compatibility with identical test results
yc199911
force-pushed
the
feat/pktbuf-window-optimization
branch
from
September 13, 2025 16:17
ebf9e24 to
1eef1ef
Compare
Owner
|
Sure, using If that's the case, the statement "Change packet alignment from O(n) to O(1) time complexity" actually means nothing, because it involves more memory allocation, which means paying extra cost in the global perspective for such "local optimization. The ideal solution is to design a ring buffer for the packet buffer. |
RinHizakura
force-pushed
the
main
branch
2 times, most recently
from
March 5, 2026 15:44
b40c643 to
dac98cc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem: pktbuf_is_complete() and pktbuf_pop_packet() use expensive memmove()
operations for packet alignment, causing O(n) performance overhead when
processing packets with garbage prefix data.
Changes:
Future Considerations
This change lays groundwork for potential ring buffer implementation with readv() zero-copy I/O. Would appreciate maintainer feedback on this direction.