-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Optimize Print::write(const char *str) #486
Comments
Virtually nothing is bounds tested. Adding bounds testing to such a low level function will considerably slow down its operation and break people's code, who rely on fast transfers Please do your bounds checking before calling write |
Well, virtually every library out there expects Arduino Core to behave this way ;) |
I think that this would make sense, even if at the end some of the overloaded functions end up with the same single writes. |
Not sure if the call to strlen would increase the size, but I agree with OP and Steve that is better to use Print::write(const void *buffer, uint32 size), should remove a lot of overhead when sending a few characters at once. |
Ah, I thought you were proposing bounds checking.. My mistake... |
Victor, take a look at the very first link of OP. |
Fix is in commit I will close this., Re-open if there is a problem |
Thanks! BTW is it only related to F1 or tp other cores as well? Didn't check them |
Good point, I should update the F4 and perhaps the F3 Note. The F3 is really not supported, there arent any F3 boards in the boards.txt, its just there as an archive, but I should probably remove it, because git will keep a record of it in the older commits |
port from rogerclarkmelbourne#486.
Fixed |
port from rogerclarkmelbourne#486.
Arduino_STM32/STM32F1/cores/maple/Print.cpp
Line 49 in 596dc0d
This should really call
strlen()
and then callPrint::write(const void *buffer, uint32 size)
implementation.Why so? Because the
write(buffer, size)
is commonly overridden and implemented in an optimized manner (sending data to the wifi/gsm module in chunks, not byte by byte...).The text was updated successfully, but these errors were encountered: