receive_any: Use trailing_zeros to improve performance#50
receive_any: Use trailing_zeros to improve performance#50showier-drastic wants to merge 1 commit intoGrepitAB:masterfrom
Conversation
In current code, `receive_any` needs to do loop operation to iterate over memory buffer to check whether there's new data which can consume a lot of CPU time. This code changes this operation to use `trailing_zeros` to get the first available message directly from NDAT register without any loops.
|
Hello @showier-drastic! Nice to see you showing interest in this crate. I am not the original implementer of this code, but I'll try the best I can to be useful. Since I haven't had any practical experience with the dedicated buffers, but instead have only used the FIFOs, do you mind providing some insight into your use-case and how you would like to use these buffers? The reason I'm asking is because I do see the validity of having a configurable priority order, by which I mean the lowest buffer (in contrast to the lowest ID) gets handled first, but I am not sure if we want to eliminate the possibility for native ID ordering (like now) as well. Maybe we could introduce some config option to specify the way we want the |
In current code,
receive_anyneeds to do loop operation to iterate over memory buffer to check whether there's new data which can consume a lot of CPU time.This code changes this operation to use
trailing_zerosto get the first available message directly from NDAT register without any loops.Thank you!
Thank you for your contribution.
Please make sure that your submission includes the following:
Must
errorsorwarnings.cargo +stable fmtwas run.cargo +stable clippyyields nowarnings.CHANGELOG.mdin the proper section.newly added features and code.