* addons: Reduce memory consumption
Parse dump files incrementaly using ElementTree.iterparse. Clean unused
resources during parsing. This method is explained in following
article: https://www.ibm.com/developerworks/xml/library/x-hiperfparse/
Memory consumption was reduced about 30% (measured with mprof),
execution time increased about 5% (measured with time utility).
More description available in PR.
* Switch to lxml and update iterparse routines
Use lxml module instead default xml.etree. Lxml provides convenient
wrappers around iterparse method that accepts `tag` argument. That
easer incremental parsing routines to select specific tags from roottree
like `dump` and `dumps`.
Element.clear() method was replaced by `lxml_clean` because lxml
keeps additional information to nodes that should be removed.
Added note about large consumption RAM on large dump files.
This commit doesn't solve this problem completely, but provides a way
to improve current parser to add incremental Configuration serialization
later.
* Working on iterative parser
* Added iterative Configurations parser
* fix
* Fix varlist iteration
* make sure that standards node was loaded
Use Python 3 instead of Python 2 if addons are executed directly.
Running cert.py and misra.py against test/cfg/std.c.dump shows that
Python 3 needs only half the time compared to Python 2. I have tested
it repeatedly and the results are always the same. This is no surprise
at all. The memory footprint is very likely also significantly better
but i have not tested it.
With multiple configurations, option --dump only dumps
the last configuration.
Fix it to dump every configuration.
Also update all Python addons so that they can handle
multiple-configuration dumps.
Additionally run autopep8 on addons/*.py.
The results of 'make test' before and after applying
this commit are identical.