perf: Efficiency and speed improvement of image upload to slides#290
Merged
k1LoW merged 20 commits intok1LoW:mainfrom Jul 21, 2025
Songmu:image
Merged
perf: Efficiency and speed improvement of image upload to slides#290k1LoW merged 20 commits intok1LoW:mainfrom Songmu:image
k1LoW merged 20 commits intok1LoW:mainfrom
Songmu:image
Conversation
Collaborator
Author
|
Thanks for the review! @k1LoW |
Merged
This file contains hidden or 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
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.
This PR improves image upload processing performance by implementing parallel image preloading, asynchronous uploads, and batch cleanup operations. The changes reduce bottlenecks in slide generation.
There are other optimization plans, but for now, I've only included this one in the pull request. It's a big change, so it may be difficult to review, but I appreciate your cooperation.
Background
Currently, existing image fetching within the slide, uploading to Google Drive, and deletion are executed sequentially for each slide, which is inefficient.
Changes
With this change, before applying the slides, the images contained in the slides to be updated are first retrieved in parallel. Then, the new images are uploaded to Google Drive asynchronously, also in parallel.
Finally, after all processing is complete, we will delete the images in parallel.
Parallelism is also limited to 4, so there is no problem with excessive requests.
Functionality check
I'm confirmed that every testing works, including integration.
In addition to simple applying, I've also checked the behavior of applying differences while watching.
Benchmark
I saw a significant difference in my 130-page document with 20 images (including code blocks). The performance will likely improve further for slides with more images.
About 15% faster than before.
current
deck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 10.50s user 1.87s system 3% cpu 5:44.63 totaldeck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 11.34s user 2.19s system 4% cpu 5:32.58 totaldeck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 10.59s user 2.17s system 3% cpu 5:24.39 totaldeck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 10.91s user 2.18s system 3% cpu 5:44.46 totalupdated
./deck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 11.03s user 1.97s system 4% cpu 4:59.93 total./deck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 11.95s user 2.08s system 4% cpu 4:41.20 total./deck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 11.04s user 2.31s system 4% cpu 4:54.49 total./deck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 11.17s user 2.04s system 4% cpu 4:37.50 total