Spending a few days with a profiler I trimmed a lot of low hanging fruit
from our bootup process. On my laptop (well-specced macbook) Mixxx
previously booted into LateNight in 5.3 (+/- 1) seconds and now it takes
2.1 (+/- 0.2) seconds.
Here're the dominant parts of how those 2.1 seconds are spent, roughly. The
times I'm citing are samples from a profiler sampling at 40 microseconds /
sample -- not direct timing measurements so they are approximate.
- 439ms The actual work of skin loading / parsing.
(SkinLoader::loadDefaultSkin). This is a mix of file I/O, image decoding,
malloc'ing our giant widget tree, Qt inefficiencies (style sheet
computation before the skin is even shown) and SvgParser inefficiencies.
- 680ms QFontDatabase::load. Mac-specific, I think. This happens regardless
of whether we install our custom fonts. This happens once during
QApplication construction and again the first time we create a widget that
relies on font size information (e.g. a QGroupBox -- so any dialog). So
this alone accounts for 30% of the startup time on my machine. WTF Qt. I
believe this is fixed in Qt 5.
- 108ms Creating the preferences dialog. (DlgPreferences::DlgPreferences)
There's no reason to create the preferences dialog on bootup instead of
when the user first requests it. Unfortunately, our Preference dialog
actually performs a role in initializing the user state and setting up
controls that tell the rest of Mixxx the user's current preferences. We
should eliminate these so that we can create the preferences dialog on
demand.
- 102ms deck / microphone / aux / preview deck construction (PlayerManager
methods).
-> Most of the time spent in these methods is creating ControlObjects.
QObject::connect is a particular hotspot since we call it so much.
QMetaObject::normalizedSignature shows up a lot here. On Qt 4.8 we can use
QMetaMethod instead of const char* signal/slot names.
-> We spend 2ms per deck creating RubberBand.
- 26ms Library creation (Library::Library)
- 18ms WaveformWidgetFactory::WaveformWidgetFactory
- 26ms EffectsManager::setupDefaults (almost all of this is creating
Controls -- QObject::connect/QMetaObject::normalizedSignature features
prominently)
-13ms SoundManager creation and setupDevices (probably varies a lot based
on your system -- I know ALSA can take a long time here).
There's a lot of room for improvement here. This also provides strong
motivation for pushing as much work as we can into separate threads. For
example -- moving controller enumerators to the ControllerManager thread
save 200ms on my machine (initializing CoreMIDI). Moving XML parsing of our
~100 presets into the CM thread was good for another ~130ms.
I have a fix that uses QMetaMethod to connect signals in some specific
hotspots that shaves another ~50ms off of engine creation and
EffectsManager::setupDefaults but it only works on Qt 4.8 and greater.
It's nice to have Mixxx bootup (sort of) quickly again!
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Get Mixxx, the #1 Free MP3 DJ Mixing software Today
http://mixxx.org
Mixxx-devel mailing list
Mixxx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mixxx-devel