Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fields: Have each type independently serialize #219

Open
henrygab opened this issue Nov 28, 2021 · 0 comments
Open

Fields: Have each type independently serialize #219

henrygab opened this issue Nov 28, 2021 · 0 comments

Comments

@henrygab
Copy link
Collaborator

Originally posted by @tobi01001 in #216 (comment)

In convertToJson(), the request is to have each unique Field_t serialization handled in the switch statement directly, rather than code multiple if statements that each run code that is common to a random subset of the types.

This will help make the code easier to understand, which reduces bugs.

On platforms that use F-Strings (ESP8266, AVR), there will be a small cost that cannot be optimized, due to the optimizer's inability to consolidate F-strings. On platforms with flat memory model (ESP32, most ARM based mcu), it is expected that the compiler will consolidate common code paths more efficiently than human hand optimization.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant