Skip to content

musicxml: support O(1) lookup of certain elements

Dan Eble requested to merge eble/lilypond:musicxml-schema into master

Allow adding schematic knowledge to Xml_node classes to simplify finding child nodes by element type. This adds some overhead, but using these features more than makes up for it.

Profiling input: https://imslp.org/wiki/File:PMLP417225-Sym41(12).zip

Profiling command:

python -m cProfile -s cumtime scripts/out/musicxml2ly \
    ~/lilypond-src/Sym4112Sco.xml

Before:

  1. 35814722 function calls (34515762 primitive calls) in 12.287 seconds
  2. 35814722 function calls (34515762 primitive calls) in 12.301 seconds
  3. 35814722 function calls (34515762 primitive calls) in 12.246 seconds

After all commits in this merge request:

  1. 29840666 function calls (28671724 primitive calls) in 11.669 seconds
  2. 29840666 function calls (28671724 primitive calls) in 11.680 seconds
  3. 29840666 function calls (28671724 primitive calls) in 11.630 seconds

See individual commits for deltas.

This merge request addresses only the three kinds of elements that are most frequently sought using the above input. I have other changes in waiting that will reduce the run time to less than 10 seconds.

Merge request reports