为什么在 Arduino 上处理字符串这么慢?

Why is it so slow to process Strings on Arduino?

我目前正在试验字符串并在 Arduino 上从串口读取数据。但我发现当你使用字符串从串行读取数据或将其与另一个字符串进行比较时,它非常慢(大约需要一秒钟)。当我使用字符从串行读取时,它变回了正常、快速的速度。 为什么这么慢?

谢谢

据此link,

https://www.arduino.cc/en/Serial/ReadString

Serial.readString() reads characters from the serial buffer into a string. The function terminates if it times out

这里是超时方法说明

https://www.arduino.cc/en/Serial/SetTimeout