-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add 'copy to array' method #52
Comments
Feel free to submit a pull request along one or two examples/test programs |
On second thought I don't think I get your request, so can you please provide a code example of what's your usage? |
I have a polynomial operation, say O(N^3). Running directly on the buffer introduces alot of overhead. Yes, copying to an array increases memory consumption, but it is worth it for the reduction in time.
|
Do you want to submit a pull request so your contribution gets traced and you get credited? |
No, it's fine. Probably quicker if you just do it. You can probably fix-up the 2nd method to accept lambdas too. |
Ok. Thanks for your contribution. Quick question: are you 100% sure the two separate loops are faster than the modulus? I'm not assembly guy... |
Yes, modulus is going to be implemented in software - most MCUs dont have an instruction for it. |
resolved in release |
I'm using the cyclicbuffer to maintain a fixed size history/lookback of samples. Every so often I need to process the contents of the buffer. Using the buffer directly is too slow, so I first copy out the contents to an array via [] operator. A dedicated copy-to-array method would be more optimal as for starters, the if statement to check index bound could be skipped. I think it would just need a loop to copy everything from head to end of buffer, and another loop to copy from start of buffer to tail. This would also avoid the expensive of having to do % operation.
The text was updated successfully, but these errors were encountered: