Open
Conversation
Contributor
Win7 x86 |
Member
|
it looks okay to me, though the complexity of the circular buffer has increased quite a bit and I didn't really try to think through every possible corner case. Is the memmove really a big enough performance concern to justify the increase in complexity? |
This allows to avoid memmove after each consume_cbuff_data. Some extra care was necessary to round queue transactions to a multiple of the sample size. I also did some refactoring on the cbuff to allow it to grow and on the resamplers to allw them to report not only how many bytes were consumed, but also how many bytes were produced, so we can move cbuff pointers accordingly. tail/head methods reports the available sizes in 2 parameters : "available" for the first chunk size, and "extra" for the optional second chunk (which starts at the buffer beginning). It's up to the caller to split it's contiguous accesses around these two chunks. Another method that I initially wanted to try was the virtual memory trick to mirror the beggining of the buffer at the end of itself. But this trick requires some code specific platform and can be tricky when we need to grow the buffer. So I went this explicit 2 chunk approach which is simpler and doesn't require platform specific code.
1c76454 to
f0ac812
Compare
Member
Author
|
@richard42 It's a fair point about complexity/performance. And I didn't really measure the performance of my changes, just thought about the theoretical benefits (and didn't observe any obvious change in my testings). That's why I asked if it helps for lower-end machines. Any how, I've rebased my changes, so it's easier to see what has changed. I don't mind if this PR doesn't make it because of added complexity vs performance increase, I proposed it mostly because I could. |
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.
This PR is based on #35 (but might be rebasable on master if needed).
The intent was to avoid the "memmove" operation during each consume_cbuff_data call.
Now we expose the fact that the buffer might be split in 2 chunks and it's up to the caller to plan accordingly.
Some care has been taken to round accesses to a multiple of the sample size (a sample cannot be splitted between the 2 buffer chunks).
I'd like some feedback on low-end systems to see if that helps a bit with performance.