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

Should this library use zerocopy rather than declarative parsing. #17

Open
Frostie314159 opened this issue Oct 28, 2024 · 3 comments
Open

Comments

@Frostie314159
Copy link
Owner

Frostie314159 commented Oct 28, 2024

@george-hopkins @kevinbader @ProfFan
I hope it's okay, that I tagged you here, but you're the only people I know, that use the library. I've been working on a Wi-Fi stack for the ESP32 written in Rust, based on the research conducted by the esp32-open-mac project and I noticed, that the declarative approach can generate a lot more code, which in some situations may be unnecessary and in general generates quite a lot of overhead. After taking a look at smoltcp's parsing code, I began thinking about using zerocopy imperative reading and writing. It would help me greatly to hear your opinion on this. I'll create a branch, where I experimentally implement zerocopy for some frame types.

Some elements, like the RSNE could benefit greatly from this, since the code gen for it is currently a mess.

@ProfFan
Copy link
Contributor

ProfFan commented Oct 28, 2024

I think smoltcp styled zero copy reading/writing is a better approach at least in embedded programs. If done nicely the API can actually be easy to use as well. The current API requires a copy in pwrite/pread every time...

@Frostie314159
Copy link
Owner Author

That was my thought process too, and I think, that we can model certain frames (e.g. Authentication) a lot better this way.

@ProfFan
Copy link
Contributor

ProfFan commented Nov 4, 2024

I found out another benefit of the smoltcp approach: the xxxRepr structs are const-friendly because they don't take any buffers, which probably allows more compiler optimization.

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

2 participants