Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some 2.2 performance improvements. #1897

Merged
merged 8 commits into from
Nov 21, 2018
Merged

Some 2.2 performance improvements. #1897

merged 8 commits into from
Nov 21, 2018

Conversation

rryan
Copy link
Member

@rryan rryan commented Nov 12, 2018

This is a grab bag of 2.2 performance tweaks, aimed at further improving performance on macOS after #1809. These were mostly discovered with a profiler while trying to get Mixxx to use less than 80% of a 4-core 2017 macbook pro when sitting idle ;).

@Be-ing
Copy link
Contributor

Be-ing commented Nov 12, 2018

Thanks for working on this. It may be helpful to set a specific time in the release cycle before the release candidate stage to focus on performance improvements driven by profiling.

@rryan
Copy link
Member Author

rryan commented Nov 12, 2018

Thanks for working on this. It may be helpful to set a specific time in the release cycle before the release candidate stage to focus on performance improvements driven by profiling.

I agree.. I'm only working on this now because while Mixxx 2.2 is usable with 2 decks, when you go up to 4 decks with 4 spinnies, it's unable to perform smoothly on ridiculously high-spec hardware (4-core 2017 macbook pro)

Copy link
Contributor

@Be-ing Be-ing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CPU usage for me goes from ~60% with one deck playing on the 2.2 branch to ~45% with this PR. This is with a quad core Intel Core i7-8550U CPU.

src/library/recording/recordingfeature.cpp Show resolved Hide resolved
src/waveform/waveformwidgetfactory.cpp Show resolved Hide resolved
src/engine/enginebuffer.cpp Show resolved Hide resolved
src/waveform/waveformwidgetfactory.cpp Outdated Show resolved Hide resolved
src/waveform/guitick.cpp Outdated Show resolved Hide resolved
@Be-ing
Copy link
Contributor

Be-ing commented Nov 14, 2018

I'm wary of merging the changes in 84054a9 regarding communication between threads at this point. Maybe we could merge the rest of this PR to 2.2 and cherry pick 84054a9 to master?

@rryan
Copy link
Member Author

rryan commented Nov 14, 2018 via email

@daschuer
Copy link
Member

Any update rate works for me that solves you issue and does not look odd.
My worries where to make a change here, just because there was an issue in the code comments.

@daschuer
Copy link
Member

LGTM
Just tested it with no notable regressions.

@Be-ing
Copy link
Contributor

Be-ing commented Nov 18, 2018

Hmm, I tested the commit before 84054a9 and CPU usage with one deck playing was the same as without this branch (~60%). I'm amazed what a big difference that change makes. I wonder if there are other relatively low hanging fruit for optimization like that where we are emitting signals between threads with a high frequency...

@Be-ing
Copy link
Contributor

Be-ing commented Nov 20, 2018

@rryan what do you think about merging this?

@rryan
Copy link
Member Author

rryan commented Nov 20, 2018

I feel they're all pretty safe except for 3205687, given the issue with Windows.

@Be-ing
Copy link
Contributor

Be-ing commented Nov 20, 2018

I agree. Can you rebase to remove that commit from this branch?

This showed up in profiling as a hotspot after disabling waveforms.
WSpinny widgets are QGLWidgets with autoBufferSwap enabled. This means that
after they are painted, they automatically run swapBuffers(). This can block the
main thread until a vsync occurs, and generally interferes with the
VSyncThread's efforts to render all the waveform widgets in one step then swap
them all at once.
@rryan rryan changed the title [DO NOT MERGE] Some 2.2 performance improvements. Some 2.2 performance improvements. Nov 21, 2018
The constants suggest the update rate was 10 Hz, but due to a sample
vs. frames difference it is actually 20 Hz. This fixes the constant
values without changing behavior.
GuiTick is delivering more and more render signals to widgets in the main
thread, and when emitted from the VSyncThread, we're putting a heavy load on the
Qt event queue. When these signals are emitted from
WaveformWidgetRenderer::render(), they are emitted from the main thread, and so
can be delivered directly rather than queued.
At 20 Hz, the GUI spends a lot of time re-drawing the WNumberPos
widgets (which can trigger re-renders of the whole UI, since their
parents need to be re-drawn).
@rryan
Copy link
Member Author

rryan commented Nov 21, 2018

Rebased to remove 3205687.

@Be-ing Be-ing merged commit 973005f into mixxxdj:2.2 Nov 21, 2018
rryan added a commit to rryan/mixxx that referenced this pull request Dec 23, 2018
…aveform widgets.

Fixes a bug where software-renderered waveform types do not work introduced in PR mixxxdj#1897.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants