feat: Add feature flags to enable specific codecs (to optimize application size)#560
feat: Add feature flags to enable specific codecs (to optimize application size)#560jbeyerstedt wants to merge 1 commit into
Conversation
|
Thank you for your PR! While I'm generally positive on this idea. I would want some validation on your claim that the current structure affects binary size. It's not disputable that it affects compile times because there are dependencies which are only used by certain codecs, but I'm not sure how it would be affecting binary size since any code that isn't used should be eliminated. Additionally I would just name the feature flags |
That's what I also thought, but at least with standard settings of an ESP-HAL project it did affect the artifact size. But for some reason they also build with "debug = 2" in the release profile (and no "strip" setting), so I just experimented a bit more with the "debug" and "strip" parameters using my ESP32 project:
So the main difference is made by stripping all symbols (which is kinda obvious and I already stripped debug symbols before). But in the end, it still makes a difference somehow. |
The size of an ASN.1 parser library can get quite big when
rasnis generating code for all supported codecs. This can be an issue on embedded targets where XER and JER encoding may not be needed when you're only operating on the rust types.This PR adds a set of feature flags to individually enable each codec "suite":
codec_ber: BER, CER and PERcodec_oer: OER and COERcodec_per: UPER and APERcodec_xer: XERcodec_jer: JERcodec_avn: AVNSadly, all codes depend on some BER and DER encoding/ decoding which means that full BER/ CER/ DER support is always carried even if e.g. only UPER is needed. But it wasn't easily achievable to only pull in the required BER and DER parts.