It was a dict with a two element list a la:
{
"id1": [len(nodeListX), nodeListX]],
"id2": [len(nodeListY), nodeListY]],
...
}
This can trivially be simplified to:
{
"id1": nodeListX,
"id2": nodeListY,
...
}
The two call-sites that actually needs the length (e.g. to sort by how
often the id is used) can trivially compute that via a call to "len".
All other call sites either just need to tell if an ID is used at all
or work the nodes referencing the id (e.g. to remap the id). The
former are unaffected by this change and the latter can now avoid a
layer of indirection.
This refactoring has negiable changes to the runtime and probably also
to memory (not tested, but it is a minor constant improvement per
referenced id).
Signed-off-by: Niels Thykier <niels@thykier.net>
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| scour.py | ||
| svg_regex.py | ||
| svg_transform.py | ||
| yocto_css.py | ||