Skip to content

Fix #18139: correctly initialize flush size in MemoryStream, and re-use writer states - #19398

Merged
Mytherin merged 3 commits into
duckdb:v1.4-andiumfrom
Mytherin:copytoallocator
Oct 15, 2025
Merged

Mytherin merged 3 commits into
duckdb:v1.4-andiumfrom
Mytherin:copytoallocator

Conversation

@Mytherin

Copy link
Copy Markdown
Collaborator

Fixes #18139

The performance variation comes from us triggering a poor case in MacOS' allocator - the issue doesn't occur outside of MacOS and requires a specific number of threads. We can avoid the issue (and it is generally good practice anyway) by doing fewer (re)-allocations.

This was already partially fixed once before in #18174 but that seems to have gotten lost in the refactor of #17692. This PR brings back that fix and adds an additional fix by reducing the number of CSVWriterState that are instantiated during batch writes.

@Mytherin
Mytherin merged commit dff9856 into duckdb:v1.4-andium Oct 15, 2025
51 checks passed
github-actions Bot pushed a commit to duckdb/duckdb-r that referenced this pull request Oct 21, 2025
Fix duckdb/duckdb#18139: correctly initialize flush size in MemoryStream, and re-use writer states (duckdb/duckdb#19398)
github-actions Bot added a commit to duckdb/duckdb-r that referenced this pull request Oct 21, 2025
Fix duckdb/duckdb#18139: correctly initialize flush size in MemoryStream, and re-use writer states (duckdb/duckdb#19398)

Co-authored-by: krlmlr <krlmlr@users.noreply.github.com>
@Mytherin
Mytherin deleted the copytoallocator branch December 4, 2025 11:31
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.

1 participant