Skip to content
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

Array and String bulk write #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yanxke
Copy link

@yanxke yanxke commented Jan 3, 2024

Pull Request Details

Provide details about your pull request and what it adds, fixes, or changes.

Use the underlying io.write(buf, len) methods when there are multiple items to be written. This dramatically speeds up the transfer speeds.

Breaking Changes

Describe what features are broken by this pull request and why, if any.

None

Issues Fixed

Enter the issue numbers resolved by this pull request below, if any.

None

Other Relevant Information

Provide any other important details below.

Tested on my Adafruit M0 and it's about 3X the transfer speed over the USB serial console.

@jfjlaros
Copy link
Owner

jfjlaros commented Jan 3, 2024

I do not think this will work when the array contains non-POD types, e.g., an array of vectors.

@yanxke
Copy link
Author

yanxke commented Jan 3, 2024

There should be a new method for sending buffer arrays then. The methods for sending generic types are too slow.

@jfjlaros
Copy link
Owner

jfjlaros commented Jan 3, 2024

I do not think overloading something like Array<uint8_t, n> will be safe. Adding an additional data member to Array will break the proposed approach for example.

Maybe an overload for specific array references could work, e.g.,

template <size_t n, size_t m>
void rpcWrite(Stream& io, uint8_t (& data)[n][m]) {
  // ...
}

@suahelen
Copy link

I had the same experience. The issue would be resolved with this PR:
jfjlaros/arduino-simple-rpc#26

@jfjlaros jfjlaros force-pushed the master branch 2 times, most recently from bdf5cf6 to 07e9b99 Compare October 19, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants