This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
use streamiterator instead of std iterator #90
Merged
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.
The idea behind this is to avoid creating the
CanFrame
, which is used to transmit the single frames, for every frame. With theStreamIterator
the frame can be initialized once per transfer and then be reused.I did some performance tests on the different implementations for transfers and got these results (cortex-m4 170 MHz, measurements in micros):
This is not that much of a performance improvement. But I think for the future this could be helpful. The now used
ArrayVec
is very efficient in array initialization and is great for the 8 byte which are used by classic CAN. But if the transmission can send a larger payload, this could give more performance boost. As well, if we have to use a heap allocated payload somehow.This new implementation will change the usage for transfer messages:
The user gets the frame as a reference. This has no limitations. If the user needs to store the frame to send somehow later, it could be done by cloning the frame. But now the user is responsible for this.