Skip to content

perf: Efficiency and speed improvement of image upload to slides#290

Merged
k1LoW merged 20 commits intok1LoW:mainfrom
Songmu:image
Jul 21, 2025
Merged

perf: Efficiency and speed improvement of image upload to slides#290
k1LoW merged 20 commits intok1LoW:mainfrom
Songmu:image

Conversation

@Songmu
Copy link
Collaborator

@Songmu Songmu commented Jul 21, 2025

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 total
  • deck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 11.34s user 2.19s system 4% cpu 5:32.58 total
  • deck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 10.59s user 2.17s system 3% cpu 5:24.39 total
  • deck apply -v -c 'silicon -l {{lang}} -o {{output}}' index.md 10.91s user 2.18s system 3% cpu 5:44.46 total

updated

  • ./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

@k1LoW k1LoW added the enhancement New feature or request label Jul 21, 2025
@Songmu Songmu changed the title pref: Efficiency and speed improvement of image upload to slides perf: Efficiency and speed improvement of image upload to slides Jul 21, 2025
Copy link
Owner

@k1LoW k1LoW left a comment

Choose a reason for hiding this comment

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

@Songmu GREAT WORK!!! L GREAT TM!

@k1LoW k1LoW merged commit 22c0ada into k1LoW:main Jul 21, 2025
1 check passed
@github-actions github-actions bot mentioned this pull request Jul 21, 2025
@Songmu Songmu deleted the image branch July 21, 2025 11:05
@Songmu
Copy link
Collaborator Author

Songmu commented Jul 21, 2025

Thanks for the review! @k1LoW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants