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

if TF_CKSUM_NONE is used, we can use memcpy instead of single byte copy loop #28

Open
asmwarrior opened this issue Nov 8, 2022 · 0 comments

Comments

@asmwarrior
Copy link

The patch something like this:

#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!

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

No branches or pull requests

1 participant