SystemRDL / PeakRDL-ipxact

Import and export IP-XACT XML register models
http://peakrdl-ipxact.readthedocs.io
GNU General Public License v3.0
31 stars 10 forks source link

importer: Migrate to ElementTree API #15

Closed bearzly closed 1 year ago

bearzly commented 1 year ago

The ElementTree API is significantly faster than the minidom API, resulting in ~60% faster imports.

Major differences:

Besides those and some minor differences in the query API, this is essentialy a drop-in replacment.

bearzly commented 1 year ago

Benchmarked with python -m timeit -s 'from systemrdl import RDLCompiler; from peakrdl_ipxact import IPXACTImporter' 'rdlc = RDLCompiler(); ipxact = IPXACTImporter(rdlc); ipxact.import_file("some_ipxact.xml")'

Results from the 4 test XML files, as well as a vendor XML file that is 297 MB and has 73k registers

IP-XACT file Before After
generic_example_2009 20 loops, best of 5: 10.2 msec per loop 50 loops, best of 5: 4.44 msec per loop
generic_example_2014 20 loops, best of 5: 10.7 msec per loop 50 loops, best of 5: 4.6 msec per loop
nested_2009 5 loops, best of 5: 38.8 msec per loop 20 loops, best of 5: 16.8 msec per loop
nested_2014 5 loops, best of 5: 41.5 msec per loop 20 loops, best of 5: 17.5 msec per loop
giant 1 loop, best of 5: 114 sec per loop 1 loop, best of 5: 47.5 sec per loop
bearzly commented 1 year ago

Thanks for merging this so quickly! We work with a lot of massive IP-XACT files so I might come back with some more performance improvements in the future.

amykyta3 commented 1 year ago

No problem! I'll hopefully deploy it within this coming week, but need to check compatibility against a few things first. A few tools I work with use this and extend/augment the behavior of the importer via vendor extensions.

amykyta3 commented 1 year ago

Published in latest release. Thanks again!