How do we keep Decoder lightweight? #169
Replies: 3 comments 13 replies
-
Good to open this discussion. We can see it as a mid-term improvement, as we still have room to optimize the current architecture. I was looking at some YAML parser but didn't dig much on how it could help: I would say that the main goal is to combine lightness and readiness regarding decoders definitions. |
Beta Was this translation helpful? Give feedback.
-
I guess this would depend on the definition of lightweight.
Starting with the first is the easiest obviously, but limited. The second could be done in a way that the applications do not need to be changed but would bloat the app, so breaking the API to use alternative JSON libraries seems necessary. The third option, as interesting as it would be, is much too extreme. YAML may have potential, I don't know how efficient the parsers are, but would still have the API breakage problem. |
Beta Was this translation helpful? Give feedback.
-
I got thinking today and perhaps there is a compromise here. If we changed the API to accept a |
Beta Was this translation helpful? Give feedback.
-
I saw the discussion about Decoder optimizations in 1technophile/OpenMQTTGateway#1248 (comment).
Especially:
I do think eventually we'll come to a point where this is inevitable if we want to keep Theengs Decoder lightweight, as we'll keep piling decoders on it.
Do you know Kaitai Struct? It's a code generator to create decoders for binary data in various languages. I have used it to generate Python code to decode RuuviTag BLE and iBeacon advertisements, and it's quite neat, with YAML code to describe structure of the data.
Unfortunately it hasn't been ported yet to generate C code, but someone has been working on it.
Maybe this (or the code generation approach in general) is something to consider in the long run?
Beta Was this translation helpful? Give feedback.
All reactions