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

[Go] BinaryBuilder AppendValues/AppendStringValues don't invoke ReserveData internally #36

Open
drahnreb1 opened this issue Apr 3, 2024 · 0 comments

Comments

@drahnreb1
Copy link

Describe the usage question you have. Please include as many useful details as possible.

AppendValues and AppendStringValues of BinaryBuilder invoke Reserve internally, but don't invoke ReserveData, e.g. by something like this:

totalLen := 0

for _, vv := range v {
    totalLen += len(vv)
}

b.ReserveData(totalLen)

Is it on purpose that ReserveData is not invoked in these functions because the idea is that users should do this themselves before invoking AppendValues/AppendStringValues?

https://github.com/apache/arrow/blob/469430f50085b4b462fcc7db84a08cb554c698cd/go/arrow/array/binarybuilder.go#L159 https://github.com/apache/arrow/blob/469430f50085b4b462fcc7db84a08cb554c698cd/go/arrow/array/binarybuilder.go#L180

Using ReserveData can significantly improve performance (in case of the benchmark test in reserve_data_test.go.txt by factor 2-3).

Component(s)

Go

@assignUser assignUser transferred this issue from apache/arrow Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant