Skip to content

multi: xfer table initial size and growth - #22705

Closed
icing wants to merge 2 commits into
curl:masterfrom
icing:multi-xfer-tbl-growth
Closed

icing wants to merge 2 commits into
curl:masterfrom
icing:multi-xfer-tbl-growth

Conversation

@icing

@icing icing commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Fine tune the multi's transfer table initial size and growth increments:

  • change initial capacity from 512 to 128
  • lower the amount of unused entries to trigger growth from a 4th to an 8th of the capacity
  • grow capacity by 50% inside limits of [128, 2048]

This lets 100 transfers run without need to regrowth and performs less reallocations for larger parallelism.

On 64-bit architectures, the 2048 growth limits grows the table by 16KB which seems a good chunk and prevents over-large growth.

icing added 2 commits August 27, 2026 11:34
Fine tune the multi's transfer table initial size and
growth increments:
- change initial capacity from 512 to 128
- lower the amount of unused entries to trigger growth
  from a 4th to an 8th of the capacity
- grow capacity by 50% inside limits of [128, 2048]

This lets 100 transfers run without need to regrowth
and performs less reallocations for larger parallelism.

On 64-bit architectures, the 2048 growth limits grows
the table by 16KB which seems a good chunk and prevents
over-large growth.
@icing
icing requested a review from bagder August 27, 2026 11:43
@bagder
bagder requested a lite review from Copilot August 27, 2026 11:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR tunes the sizing strategy for the multi handle’s multi->xfers transfer table to reduce memory footprint at startup and adjust when/how the table grows under higher parallelism.

Changes:

  • Reduce the default transfer table initial capacity from 512 to 128.
  • Change the growth trigger threshold from ~25% free rows to ~12.5% free rows.
  • Update the growth step to add ~50% capacity (bounded to a +[128, 2048] row increment) while staying within UINT_MAX - 1.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/multi.c
@bagder bagder closed this in d013a19 Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants