-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Multi-threaded media export #1617
Merged
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
heinezen
added
improvement
Enhancement of an existing component
lang: python
Done in Python code
area: assets
Involved with assets (images, sounds, ...)
labels
Jan 20, 2024
heinezen
force-pushed
the
feature/export_threaded
branch
from
January 21, 2024 06:10
d41e544
to
33b25b9
Compare
heinezen
force-pushed
the
feature/export_threaded
branch
from
January 25, 2024 18:37
fe334da
to
97a67c7
Compare
TheJJ
approved these changes
Jan 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: assets
Involved with assets (images, sounds, ...)
improvement
Enhancement of an existing component
lang: python
Done in Python code
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.
Makes large parts of the media export process multi-threaded.
We previously had a multi-threaded solution in the converter that was deactivated when the new converter was. This implementation doesn't reintroduce this behavior and instead opts for a simpler solution using Python's
multiprocessing
module withPool
,Manager
andQueue
. Low-level routines were not needed and the solution now works (with adjustments) for all media files.The method used is based on the main thread loading the file data and feeding it as a producer to the worker threads. The worker threads convert the data and write the result to file.
The speedup is mostly negligable for the earlier game versions (until SWGB) where the files are small and fast to convert, so the main process cannot provide data fast enough to fully use all available resources. The time gains there are mostly eaten up by the overhead of the thread pool. However, there are signifiant speedups for DE1 and DE2 where export times are cut down to 25% of the previous runtime. Here are some before/after export times for comparison:
AoE1 (1997)
AoE2 (1999)
SWGB
HD Edition
DE1
DE2