Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3624

The Set structure should not waste memory with data pointers

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: libutils
    • Labels:
      None
    • Story Points:
      3

      Description

      Right now, the Set structure is defined as a Map with no data, only keys. However, the pointers to the data are still allocated because the Map contains MapKeyValue structures. This means that for every item in every Set, up to 8 extra bytes are allocated (64 bits) and never used, increasing the memory footprint.

      It would be nice to have Set and Map defined using shared code and definitions, but without the extra overhead for sets.

      Plus if we do this in a smart way, we can get rid of the Map *impl trick used for StringMap and other "typed" maps.

      Another potential benefit could be maps/sets with integer keys, but that's probably out of scope of this task, doable if it turns out to be low-hanging fruit.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            vpodzime Vratislav Podzimek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: