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

[C++] Remove unnecessary safe operations for ListBuilder and BinaryBuilder #35611

Closed
js8544 opened this issue May 16, 2023 · 0 comments · Fixed by #35613
Closed

[C++] Remove unnecessary safe operations for ListBuilder and BinaryBuilder #35611

js8544 opened this issue May 16, 2023 · 0 comments · Fixed by #35613

Comments

@js8544
Copy link
Collaborator

js8544 commented May 16, 2023

Describe the enhancement requested

There are several safety checks/operations that can be optimized to enhance performance of ListBuilder and BinaryBuild, including:

  1. Redundant safety checks
  2. Unnecessary safe Append after Reserve is called
  3. In AppendArraySlice, space is reserved for each array element but pre-allocation for the whole batch is possible

Component(s)

C++

js8544 added a commit to js8544/arrow that referenced this issue May 16, 2023
js8544 added a commit to js8544/arrow that referenced this issue May 16, 2023
js8544 added a commit to js8544/arrow that referenced this issue May 16, 2023
js8544 added a commit to js8544/arrow that referenced this issue May 22, 2023
@pitrou pitrou added this to the 13.0.0 milestone May 22, 2023
pitrou pushed a commit that referenced this issue May 22, 2023
…d BinaryBuilder (#35613)

### Rationale for this change

There are several safety checks/operations that can be optimized to enhance performance of ListBuilder and BinaryBuild

### What changes are included in this PR?

1. Remove redundant safety checks
2. replace Append with UnsafeAppend when possible
3. In AppendArraySlice, pre-allocate space for the whole batch.

### Are these changes tested?

Yes, by existing tests in array_test.cc.

### Are there any user-facing changes?

No. 

* Closes: #35611

Authored-by: Jin Shang <shangjin1997@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants