Wednesday, May 9, 2012

Music21 speedups in Chordify and with PyPy

The biggest recurring complaint about using music21 is the speed at working with large scores. I wanted to point out two resources that are available in the latest SVN releases. Both will appear in the next public release, but for some people you might want to try it already:

  1. Some parts of chordify move from O(m^2) time to O(m) where m is the number of measures in a part – for very large scores, this will mean a huge speedup. (usually noticeable after about 100 measures)
  2. Music21 works with the rewrite of python called PyPy – which is a sped-up version of python 2.7. The only parts that don’t work are plotting algorithms, since matplotlib and numpy aren’t yet ported to pypy. Most operations will see about a halving of the speed – the exception is in parsing files a second and subsequent time (however, the first time is quite a bit faster).

Work on running music21 on multiple systems is proceeding, so we should be able to demonstrate that soon.

Thanks for the patience. My motto is “make it work first, make it faster later.” which I sometimes translate as, “we’ve waited 200 years to have a tool that can analyze thousands of works at once; we can wait another 20 minutes.” but that doesn’t mean we’re not working all the time to make music21 run as fast as we can.