#if TF_CKSUM_TYPE == TF_CKSUM_NONE
memcpy(outbuff, data, data_len);
#else
for (i = 0; i < data_len; i++) {
b = data[i];
outbuff[pos++] = b;
CKSUM_ADD(*cksum, b);
}
#endif // TF_CKSUM_TYPE
In our test, it looks like using memcpy is much faster, and in one test, it reduced to 1/40 of the manually loop byte copy time.
I have use this library in several projects.
For example, I use it in UDP data sending, I think we don't need CRC check here, because the UDP protocol already does some data check.
While the UDP package is not sending in a synchronized way, so I use the ID filed of the TinyFrame to resort the messages. It works really nice! Thanks for this great project!
The patch something like this:
In our test, it looks like using memcpy is much faster, and in one test, it reduced to
1/40
of the manually loop byte copy time.I have use this library in several projects.
For example, I use it in UDP data sending, I think we don't need CRC check here, because the UDP protocol already does some data check. While the UDP package is not sending in a synchronized way, so I use the
ID
filed of the TinyFrame to resort the messages. It works really nice! Thanks for this great project!