nfroidure / midifile

A MIDI file parser/writer using ArrayBuffers
http://karaoke.insertafter.com
MIT License
199 stars 30 forks source link

Getting events for large midi's (black midis) takes FOREVER #26

Closed FireController1847 closed 6 years ago

FireController1847 commented 6 years ago

I'm a gentledev i:

Expected behavior

It doesn't take 5-15 minutes to load. A reasonable time, like many other apps, is 1 minute. VanBasco's took 2 seconds.

Actual behavior

It takes FOREVER to load.

Steps to reproduce the behavior

Load up a black midi with lots of notes (insane, like 5-10 million) and run midi.getMidiEvents()

Debugging informations

nfroidure commented 6 years ago

Discovering the concept of Black MIDI.

This project was not created with heavy performances in mind and the result you're getting is not surprising me.

Despite I think supporting that kind of MIDI file could be achieved, I won't do it since it would take a lot of time I currently do not have.

This project was just a PoC, it accidentally begun to be used by people despite not actively maintained. I'm still wondering why tbh ;).

For those unfamiliar with black MIDIs: https://thump.vice.com/en_us/article/8q74wb/meet-the-15-year-old-prince-of-black-midi

Edit: Of course, would merge any PR allowing to play those files.

mk-pmb commented 6 years ago

Thanks for introducing me to the "black MIDI" phenomenon. (Summary: So many notes that the sheet music view is mostly black.) I think we should clarify our README's claim "What it does: • Read MIDI files" by adding "(very slow for huge/"black" files)". What do you think?

Edit: @FireController1847 , could you provide a link to a free black MIDI so anyone trying to optimize can test it?

FireController1847 commented 6 years ago

I think it should be noted that when run in an administrator command prompt and manually allowing more ram using the --max_old_memory thing makes it load much, much faster. In fact, I noticed without it the application actually ran out of memory as it used 2.6 GB to load it. I'll get a link ASAP

mk-pmb commented 6 years ago

Oh, that's good to know. In that case the slowness most probably wasn't a problem with this module, but just swapping on a slow disk.

FireController1847 commented 6 years ago

I actually have an SSD on this laptop :joy: But either way allowing more RAM fixed the issue. Here's a direct link to one of the Midi's.