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
Analyser queue signal rework #6734
Comments
Commented by: daschuer |
Commented by: rryan Thanks for putting the patch together. I am trying to understand why it gives a speed improvement. The code in lp:mixxx/1.11 emits 2 signals per progress update: Both are queued in the event queue so their slots are invoked by the main thread. The code in your patch emits: But only updateProgress should be queued in the event queue while the latter 2 are direct invoked. The progressUpdateInhibitTimer delays at least 60ms between progress updates so we are really talking about the difference between 2 queued events every 60 ms and 1 queued event every 60ms. My question is does this really have a measurable benefit on analysis time and Qt event queue length? The semaphore signalling increases the complexity of this section of code by a lot so I'd rather not do it if we don't get a benefit. You measured 7.5s -> 7s. Did you measure it many times and take an average or is this just a one-off? I wonder what the average and variance of the distribution of analysis times for a single track is if you analyse it over and over. It's possible the 0.5s speed increase was just noise or within the variance of the measurement. I wonder how we could easily test if this is a statistically significant change. Also there are many other factors at play. The engine is always calculating while you run these tests so it's adding to the measurement noise. We could make a standalone binary that instantiates the analyser queue and tries to analyze a track over and over. It seems very odd that doing 1 extra queued event every 60ms is enough to cause 0.5s of overall analysis time difference. Some other minor code comments:
|
Commented by: daschuer Hi RJ Thank you for your review. I Think you read the code right. The speed improvement is not the cause for this patch. I just put the argument in to show that the patch does not put additional delay to the analyser process. I measure it about five time with a manual stopwatch, so not that reliable. The main benefit of this patch is that it stops the Analyser from overload the QT event Queue, if the GUI thread is already busy. With patch I have still jerking but not that extreme. The original solution with the priority inversion was slightly better but it puts additional delay on the analyser process for all users. This patch is a tiny part of the whole performance issue. I can live without it, but ... WOverview::slotTrackLoaded is connected in legacyskinparser to bastrackplayer, this is missing in the patch. WOverview::m_trackLoaded is needed for my upcoming patch which will show "Ready to play, analyzing .." when the track is loaded but the analysis has not started. |
Commented by: rryan OK -- if you see it improve jerking repeatably on your Atom then I can't argue with that :). Go ahead and commit it. But I still don't understand. It's true malloc isn't free and the reference counting from copy-constructing TrackPointers isn't cheap but when we talk about 'expensive' and 'cheap' we're talking about the nanosecond timescale. For something like jerking to happen I think we're having a much more serious problem than an extra malloc here and there every 60ms. |
Commented by: daschuer Hi RJ, There is no measurable Timing improvement on an idle System when doing mass analysis with this patch. I will check that. |
Commented by: daschuer Ah, here it is: |
Commented by: daschuer Committed to lp:mixxx/1.11 #3572 |
Issue closed with status Fix Released. |
Reported by: daschuer
Date: 2012-12-02T11:56:11Z
Status: Fix Released
Importance: Medium
Launchpad Issue: lp1085613
Attachments: analyser_queue_signals.patch
The attached patch is a rework of the signals emitted from Analyser queue patch.
In general we should prevent to fire timer driven signals between threads, to prevent the GUI Thread from process outdated data when there is high load anyway.
This patch is an improved solution from what was rejected in Bug #1008721.
The text was updated successfully, but these errors were encountered: