Skip to content

Avoid scanning download directories for range cleanup - #5

Closed
KingKrab23 wants to merge 1 commit into
frostlinuxdev:mainfrom
KingKrab23:fix/download-range-cleanup
Closed

KingKrab23 wants to merge 1 commit into
frostlinuxdev:mainfrom
KingKrab23:fix/download-range-cleanup

Conversation

@KingKrab23

Copy link
Copy Markdown
Contributor

I noticed that while downloading Azur Promilia JP, Nadare was looking through the whole folder after every file it downloaded. With tens of thousands of files, Nadare was spending a lot of time looking for temporary files that usually weren’t there.

It fixes a download throughput bottleneck. Nadare was scanning the entire folder after each file finished, which slowed it down between downloads. Skipping those scans should make downloads faster and steadier for games with lots of files.

The game was able to download about 20 times faster with this change.

Thanks for putting this project together - if you don't like the merge feel free to decline and do it differently or not at all, but it did really help. I was seeing in the KiB/s ranges anywhere from 8-33 threads which was making this obviously much slower.

@frostlinuxdev

Copy link
Copy Markdown
Owner

Thank you for taking the time to notify and send a PR even. It is greatly appreciated by me and Nadare users. Any further contributions are not required of course but are always welcome. On track to be added to next update. The 2nd community PR on the repo as well, thankful people have taken an interest in this project.


The rest of this reply was written by an AI assistant (Claude Code) on the maintainer's behalf.

You're right: after every finished file, the cleanup listed the whole folder to find leftover range pieces. On a folder of 30,000 files that's about 0.1 s per file, which adds up to most of an hour on a big game. Your check for the .ranges.json record first is correct, because the pieces never exist without it: the record is written before them and removed after them. Every call site is covered, and the forced clears where an old layout has to go are right.

Your commit was taken as it is, under your name, into the development branch, with tests on top: no folder listing without a record, pieces from any worker count up to 32 removed with their record, and a forced clear without a record. It also went through a 1,000-world download simulation across every game that installs loose files (the worst, PGR, has about 85,000 in one folder), and it held up. It will ship in the next release, and you will be credited as co-author on the release commit, in the release notes and in CONTRIBUTORS.md.

This repository is the published release tree: each release lands here as a single commit cut from the development branch, so pull requests aren't merged here directly. This one will be closed once the release carrying it is out, with a link to it.

From now on we ask for a DCO sign-off on commits (git commit -s); CONTRIBUTING.md will say so from the next release. Nothing is needed for this one.

@frostlinuxdev

Copy link
Copy Markdown
Owner

Thank you! This fix shipped in Nadare 0.1.0b29. Releases reach this repository as one commit each, so your change landed there with you as co-author rather than as a merge of this pull request; you are also in CONTRIBUTORS.md. Closing it for that reason.

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