Memory Consumption in Elektra is quite high as the key names are long and stored twice in memory.
- comparing of keys and thus searching in key sets must be possible with memcmp
- printing the escaped key name is not so much used in typical applications and in tooling doing extra escaping does not matter
- store both
- store both but in one memory block (previous implementation)
- only store escaped name
Only store the unescaped key name, suitable for comparing/searching/iterating over name, i.e.:
- Remove the escaped name from
struct _Key
and use it only when necessary. - Clarify and reduce terminology.
- API Changes:
keyNew (const char*, size_t)
keyName
returns the unescaped name- remove
keyUnescapedName
,keyGetUnescapedNameSize
. - reverse terminology: with "key name" we will refer to the unescaped (base) name, the escaped name will be explicitly called "escaped key name".
- escaped name will be outside the core for tooling
keyDup(.., int)
with options to filter which parts are copied (to allow copy of keys where only the key name is copied)
- saves memory
- reduces API (
keyUnescapedName*
)
- users should use compare functions, .. instead of
keyName
- modifications in keyNew needed