Skip to content

Performance: Creation of DetuningHelper in class Note slows down file load and MIDI import #2029

@michaelgregorius

Description

@michaelgregorius

I did some profiling with Valgrind and it turns out that the loading of files and the import of MIDI files is slowed down by the creation of DetuneHelper in Note.

You can test the impact of the code for file loading as follows:

  1. Compile a vanilla version from master.
  2. Start LMMS and load the file DnB.mmpz from the Demos folder.
  3. Close LMMS.
  4. Comment out the calls to createDetuning in Note::Note and Note::loadSettings.
  5. Recompile and start LMMS again.
  6. Load DnB.mmpz from the Demos folder again.

The impact for MIDI import can be tested in a similar fashion. You only have to import a MIDI file instead of loading an LMMS file. An example MIDI file can be found at http://www.eurokdj.com/ringtones/midi_files/Twenty_4_Seven-Take_Me_Away.mid. (Please refer to #1971 for other source for MIDI files).

The main problem with createDetuning seems to be the sheer number of DetuningHelpers that are created during the load/import. Even though they are created using the MemoryPool their creation still slows the code down significantly. It's very likely that this problem can only be alleviated by changing the design. Does every note really need its own DetuningHelper? Is it possible to keep the DetuningHelper as an aggregate in Note and not as a pointer?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions