-
Notifications
You must be signed in to change notification settings - Fork 278
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
Huge performance improvements (43% faster FFmpegReader, 34% faster Timeline) #638
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… Calling OMP_MP_NUM_PROCESSORS less often, since it's quite expensive according to profiling. Adjusting Timeline final_cache to match the video caching thread max_frames, so one doesn't clobber the other. Also, fixing an issue with openshot-player, where a video file with no audio skips horribly.
…4. Trying to experiment and reduce stuttering.
… on the Timeline and FFmpeg-related classes). The logic behind this decision, was based on profiling libopenshot and the amount of wasted CPU idle time on all the various threads. The slow code is still synchronous, and all the threads must wait on each other, adding additional overhead. So, removing lots of unneeded threads, and simplifying the underlying Timeline->Clip->FFmpegReader flow. Also, removed 2 calls to QPainter::drawImage, by improving the flexibility of Clip->GetFrame.
…t add any performance (in my tests)
Codecov Report
@@ Coverage Diff @@
## develop #638 +/- ##
===========================================
- Coverage 51.86% 51.54% -0.32%
===========================================
Files 151 151
Lines 12334 12228 -106
===========================================
- Hits 6397 6303 -94
+ Misses 5937 5925 -12
Continue to review full report at Codecov.
|
Merging this one! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After some extensive profiling using a variety of tools, we have found a few interesting and actionable issues. Bottom line, OpenMP is not actually providing us any improvement where we need it, and instead, it's adding additional overhead, by spinning up many threads, waiting for threads to finish, shutting down threads, etc...
Related openshot-qt PR: OpenShot/openshot-qt#4012
Improvements:
Timeline
,FFmpegReader
classes. These are now optimized to return the first matching frame as quickly as possible (no more attempting to process a bunch of Frame instances in multiple threads).QPainter::drawImage
multiple times (and saves a bunch of CPU)Testing: