Instruments get saved on each new block in the SongEditor
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 1.3k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 7
Description
Performance issue, not directly critical.
Each time you add a block in SongEditor (e.g. because you want to edit this block and add some notes in it), SerializingObject::saveSettings is being called. For zyn, and assumably VST, this causes QTemporaryFile creation, i.e. file system operations on each edit. If a Linux user deosn't have /tmp as a tmpfs, this is very bad.
#2 0x00007fffade045ff in OscInstrument::saveSettings (this=0x1000190020, _doc=..., _this=...) at .../plugins/oscinstrument/oscinstrument.cpp:135
#3 0x000055555573d5e9 in SerializingObject::saveState (this=0x1000190040, doc=..., parent=...) at .../src/core/SerializingObject.cpp:55
#4 0x000055555570116a in JournallingObject::saveState (this=0x1000190040, _doc=..., _parent=...) at .../src/core/JournallingObject.cpp:72
#5 0x0000555555844e5d in InstrumentTrack::saveTrackSpecificSettings (this=0x10000ca7e0, doc=..., thisElement=...) at .../src/tracks/InstrumentTrack.cpp:738
#6 0x000055555574fcd2 in Track::saveSettings (this=0x10000ca7e0, doc=..., element=...) at .../src/core/Track.cpp:2144
#7 0x000055555573d5e9 in SerializingObject::saveState (this=0x10000ca800, doc=..., parent=...) at .../src/core/SerializingObject.cpp:55
#8 0x000055555570116a in JournallingObject::saveState (this=0x10000ca800, _doc=..., _parent=...) at .../src/core/JournallingObject.cpp:72
#9 0x000055555572da86 in ProjectJournal::addJournalCheckPoint (this=0x555555f7bbb0, jo=0x10000ca800) at .../src/core/ProjectJournal.cpp:121
#10 0x0000555555701113 in JournallingObject::addJournalCheckPoint (this=0x10000ca800) at .../src/core/JournallingObject.cpp:60
#11 0x000055555574d4b6 in TrackContentWidget::mousePressEvent (this=0x555556b36580, me=0x7fffffffd1f0) at .../src/core/Track.cpp:1594
#12 0x00007ffff74f2b0f in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#13 0x00007ffff74b1fec in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#14 0x00007ffff74b9f41 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#15 0x00007ffff474bce0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#16 0x00007ffff74b8eca in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQt5Widgets.so.5
#17 0x00007ffff750d949 in ?? () from /usr/lib/libQt5Widgets.so.5
#18 0x00007ffff7510060 in ?? () from /usr/lib/libQt5Widgets.so.5
#19 0x00007ffff74b1fec in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#20 0x00007ffff74b99c6 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#21 0x00007ffff474bce0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#22 0x00007ffff4cbf434 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#23 0x00007ffff4cbf6c1 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#24 0x00007ffff4cc0f86 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
#25 0x00007ffff4c9829c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#26 0x00007fffec2c848d in ?? () from /usr/lib/libQt5XcbQpa.so.5
#27 0x00007ffff474a31b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#28 0x00007ffff4753718 in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#29 0x00005555556b0bad in main (argc=1, argv=0x7fffffffddb8) at .../src/core/main.cpp:966
Suggestions:
- Changes in the
SongEditorshould not influence the instrument's state, at least not for external plugins. No save should be done when adding a block. Suggested by @PhysSong - Optional: Implement a different function for this use case:
saveSettingsToRam
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the SongEditor block-add path from Track.cpp:1594 through ProjectJournal.cpp, JournallingObject.cpp, SerializingObject.cpp, and InstrumentTrack.cpp:738. Reproduce adding a block while observing the save stack, then determine how journaling can avoid saving instrument state for this edit. Done means adding a block no longer performs unnecessary instrument file operations while journal state remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100