Skip to content

schc_header_field_names very wasteful #33

@miri64

Description

@miri64

There are two issues with the schc_header_field_names array with how it is currently implemented:

  1. It is defined in a header file, i.e. it is created in ROM for every compile unit where it is included and used. Currently, it is only used in compressor.c, so I would recommend moving its definition there and maybe provide a field2str() function as an accessor function in case it is needed outside of compressor.c.
  2. It uses schc_header_fields as indexes, of which IP6_V has value 1024 defined. This means, that the first 1024 entries of the array are empty, so on a 64-bit platform 1024 * (64 / 8) = 8192, so 8kB are just wasted.

While this is only a debugging feature, it should also not add wasteful overhead. My proposal would be to decouple the CoAP option field values from the CoAP option values, which seems to be the reason, why IP6_V is defined at 1024, and have no jumps within the definition of schc_header_fields (i.e. have IP6_V be 0, and let the rest be defined by the enum order), so the schc_header_field_names array only uses as much space as it needs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions