Skip to content

update auto piece size calculation - #8015

Open
Audionut wants to merge 1 commit into
arvidn:RC_2_0from
Audionut:piece-size
Open

update auto piece size calculation#8015
Audionut wants to merge 1 commit into
arvidn:RC_2_0from
Audionut:piece-size

Conversation

@Audionut

Copy link
Copy Markdown

The existing code has a hard defined limit of 8 MiB,.

This PR iterates through the piece sizes, up to 128 MiB piece size, to keep the piece count between 1000 and 2000.

@stalkerok

Copy link
Copy Markdown

I would significantly reduce the initial value, from 300.

@arvidn

arvidn commented Sep 7, 2025

Copy link
Copy Markdown
Owner

what's the motivation for this change? I imagine you want the .torrent file to be smaller, but it has to be weight against the performance of swarm as well, right?

@arvidn

arvidn commented Sep 7, 2025

Copy link
Copy Markdown
Owner

also, some torrent clients don't support piece sizes of 16 MB or greater

@Audionut

Audionut commented Sep 7, 2025

Copy link
Copy Markdown
Author

To maintain performant piece counts without arbitrary limits.

If piece count was irrelevant, then a fixed size should be defined, reducing code clutter and uncertainty.

I am not aware of any relatively modern client having a 16 MiB piece size limit, nor am I sure why overall swarm performance should be limited because of 1 or 2 clients, that would seemingly wish to maintain updated libtorrent, but not also update their end, to support codebase changes.

@arvidn

arvidn commented Sep 7, 2025

Copy link
Copy Markdown
Owner

To maintain performant piece counts without arbitrary limits.

Please elaborate

I would expect performance to suffer from larger pieces, since you need to download more before you can start uploading.

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.

3 participants