Skip to content

Improve downloaddata.py download performance - #511

Merged
blowekamp merged 1 commit into
InsightSoftwareConsortium:mainfrom
blowekamp:throttle-download-progress-reporting
Sep 23, 2026
Merged

blowekamp merged 1 commit into
InsightSoftwareConsortium:mainfrom
blowekamp:throttle-download-progress-reporting

Conversation

@blowekamp

Copy link
Copy Markdown
Member

Summary

Improves the performance of Utilities/downloaddata.py for downloading the tutorial data, which was spending a disproportionate amount of time on console progress updates and doing many small reads.

Changes

  • Throttle url_download_report to update the console at most every 100ms (using time.monotonic()), instead of on every chunk read. Still shows an immediate first update and always shows the final 100% line.
  • Increase the default download chunk size in url_download_read from 16KB (8192*2) to 1MB.

Testing

Benchmarked downloading a 74MB file (fib_sem_bacillus_subtilis.mha):

  • 16KB chunks: ~35s
  • 1MB chunks: ~4.35s

Also ran the full Utilities/downloaddata.py Data/ Data/manifest.json against the complete manifest to confirm all files still download and verify correctly.

…rease chunk size

- Throttle url_download_report to update at most every 100ms instead of
  every chunk, avoiding excessive stdout write/flush overhead.
- Increase the default download chunk size from 16KB to 1MB, reducing
  the number of read()/callback calls per file.
@blowekamp
blowekamp requested a review from zivy September 23, 2026 12:00

@zivy zivy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Because the download mechanism uses caching this only has an effect on the first download, but faster is always better.

@blowekamp

Copy link
Copy Markdown
Member Author

Because the download mechanism uses caching this only has an effect on the first download, but faster is always better.

This is a significant time improvement for the users.

@blowekamp
blowekamp marked this pull request as ready for review September 23, 2026 13:18
@blowekamp
blowekamp merged commit 934b217 into InsightSoftwareConsortium:main Sep 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants