Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add BatchN to create a batch with an initial capacity. #1879

Closed
wants to merge 1 commit into from

Conversation

s-l-teichmann
Copy link

This PR adds a function BatchN which returns a batch with a pre-allocated capacity.
I ran more than once into the situation that I know beforehand how large my Batch is going to be.
As there is no way to access the slices holding the queries I've added this kind of
constructor. Maybe you find this helpful.

@jackc
Copy link
Owner

jackc commented Jan 20, 2024

Have you benchmarked any significant improvements with this change? Given all that goes on in queuing the queries, sending the batch, and reading the results of all the queries, it would surprise me if removing saving the allocation was noticeable.

@jackc
Copy link
Owner

jackc commented Jan 21, 2024

Also, please take a look at #1878. If that proposal comes to fruition that would also allow the preallocation you are looking for.

@pashagolub
Copy link
Contributor

Can be solved by #1886

@jackc
Copy link
Owner

jackc commented Jan 26, 2024

Closed in favor of #1886.

@jackc jackc closed this Jan 26, 2024
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