scour/scour
Niels Thykier 258c782c8c Simplify the "ids" structure returned by findReferencedElements
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>
2018-02-17 11:14:56 +00:00
..
__init__.py Scour v0.36 2017-08-06 04:55:59 +02:00
scour.py Simplify the "ids" structure returned by findReferencedElements 2018-02-17 11:14:56 +00:00
svg_regex.py Some whitespace fixes to make newer versions of flake8 happy 2016-11-27 18:52:39 +01:00
svg_transform.py Some whitespace fixes to make newer versions of flake8 happy 2016-11-27 18:52:39 +01:00
yocto_css.py Consistent whitespace across source files according to PEP 8 2016-09-15 00:35:13 +02:00