The plugin can take a half second to serialize, because it is saving a sequence with thousands of notes. The notes came from a MIDI file, which can be arbitrarily large.
My current approach is to save the edit history, so that the current state can be reconstructed from the original MIDI. If autosave gets slow, the user can save to create a new base MIDI file.
The downside to this is that if the user wishes to share their work, they need to include the MIDI files they’ve edited in addition to their VCV patch file. If there was a way to distinguish calls to
PatchManager::save(), I could serialize all the data into a single file only when the user is saving patch data.