google / emboss

Emboss is a tool for generating code that reads and writes binary data structures.
Apache License 2.0
67 stars 20 forks source link

Strip comments from templates #133

Closed EricRahm closed 2 months ago

EricRahm commented 2 months ago

This removes comments related to the emboss backend code generator from the generated emboss headers. For an example project we see several MB of reduction in size of the generated headers:

File src (KB) .h (KB) before .h (KB) after
hci_events.emb 76 7488 5356
hci_commands.emb 108 7376 5612
hci_vendor.emb 32 2328 1748
hci_common.emb 32 824 644
hci_data.emb 4 204 152
l2cap_frames.emb 4 60 48
hci_h4.emb 4 8 8

The comments are stripped while generating the code fragment templates, this allows us to keep comments useful to emboss development in-place while reducing the impact on generated code size.

This is part of resolving #128

EricRahm commented 2 months ago

Note this is stacked on #130, only the patch titled Strip comments from temlates is relevant.

EricRahm commented 2 months ago

FYI @robrussell.