Skip to content

refactor: Reuse buffers for wide string conversion on Windows#738

Merged
DataTriny merged 1 commit into
mainfrom
windows-reuse-buffers
Jul 13, 2026
Merged

refactor: Reuse buffers for wide string conversion on Windows#738
DataTriny merged 1 commit into
mainfrom
windows-reuse-buffers

Conversation

@DataTriny

Copy link
Copy Markdown
Member

Initially extracted from stacked-alloc-refactors but significantly reworked.

Introduce reusable buffers for wide string conversion in the Windows adapter to reduce memory allocations. The initial work used two separate buffers tied to the adapter instance, I chose to go with a thread-local pool of buffers, mostly to avoid acquiring a lock for each node property getter, even if they don't convert strings. Multiple adapters can also share the same buffers. I capped the buffer size to avoid keeping large memory chunks around.

@mwcampbell mwcampbell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for taking the time to improve on my version and add test coverage.

@DataTriny DataTriny merged commit 7296cc9 into main Jul 13, 2026
21 checks passed
@DataTriny DataTriny deleted the windows-reuse-buffers branch July 13, 2026 18:21
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