You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/11/30 07:32:42 UTC
[GitHub] [arrow] Dandandan opened a new pull request #8803: ARROW-10772: [Rust] Speed up take by writing to buffer
Dandandan opened a new pull request #8803:
URL: https://github.com/apache/arrow/pull/8803
This speeds up `take` a bit more by creating / writing to a buffer directly instead of creating an intermediate Vec. Quite some kernels could benefit from such a change.
@jorgecarleitao I don't know whether this is the correct/easiest way of doing this currently?
I also think it is related to your PR/discussion about using `Vec` .
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] ritchie46 commented on a change in pull request #8803: ARROW-10772: [Rust] Speed up take by writing to buffer
Posted by GitBox <gi...@apache.org>.
ritchie46 commented on a change in pull request #8803:
URL: https://github.com/apache/arrow/pull/8803#discussion_r532413954
##########
File path: rust/arrow/src/compute/kernels/take.rs
##########
@@ -214,19 +215,20 @@ where
let null_count = array.null_count();
- // This iteration is implemented with a while loop, rather than a
- // map()/collect(), since the while loop performs better in the benchmarks.
- let mut new_values: Vec<T::Native> = Vec::with_capacity(data_len);
+ let mut buffer = MutableBuffer::new(data_len * std::mem::size_of::<T::Native>());
+ buffer.resize(data_len * std::mem::size_of::<T::Native>());
+ let data = buffer.typed_data_mut();
+
let nulls;
if null_count == 0 {
// Take indices without null checking
- for i in 0..data_len {
+ for (i, elem) in data.iter_mut().enumerate() {
Review comment:
Nice! This feels more safe than indexing.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #8803: ARROW-10772: [Rust] Speed up take by writing to buffer
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #8803:
URL: https://github.com/apache/arrow/pull/8803#issuecomment-735614181
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for opening a pull request!
Could you open an issue for this pull request on JIRA?
https://issues.apache.org/jira/browse/ARROW
Then could you also rename pull request title in the following format?
ARROW-${JIRA_ID}: [${COMPONENT}] ${SUMMARY}
See also:
* [Other pull requests](https://github.com/apache/arrow/pulls/)
* [Contribution Guidelines - How to contribute patches](https://arrow.apache.org/docs/developers/contributing.html#how-to-contribute-patches)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #8803: ARROW-10772: [Rust] Speed up take by writing to buffer
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #8803:
URL: https://github.com/apache/arrow/pull/8803#issuecomment-735625165
https://issues.apache.org/jira/browse/ARROW-10772
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] andygrove closed pull request #8803: ARROW-10772: [Rust] Speed up take by writing to buffer
Posted by GitBox <gi...@apache.org>.
andygrove closed pull request #8803:
URL: https://github.com/apache/arrow/pull/8803
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] ritchie46 commented on pull request #8803: ARROW-10772: [Rust] Speed up take by writing to buffer
Posted by GitBox <gi...@apache.org>.
ritchie46 commented on pull request #8803:
URL: https://github.com/apache/arrow/pull/8803#issuecomment-735933382
Already experimented a bit for the stringarray variant. https://github.com/ritchie46/polars/pull/193
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] Dandandan commented on a change in pull request #8803: ARROW-10772: [Rust] Speed up take by writing to buffer
Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #8803:
URL: https://github.com/apache/arrow/pull/8803#discussion_r532415763
##########
File path: rust/arrow/src/compute/kernels/take.rs
##########
@@ -214,19 +215,20 @@ where
let null_count = array.null_count();
- // This iteration is implemented with a while loop, rather than a
- // map()/collect(), since the while loop performs better in the benchmarks.
- let mut new_values: Vec<T::Native> = Vec::with_capacity(data_len);
+ let mut buffer = MutableBuffer::new(data_len * std::mem::size_of::<T::Native>());
+ buffer.resize(data_len * std::mem::size_of::<T::Native>());
+ let data = buffer.typed_data_mut();
+
let nulls;
if null_count == 0 {
// Take indices without null checking
- for i in 0..data_len {
+ for (i, elem) in data.iter_mut().enumerate() {
Review comment:
Yes, it also leads to faster code in some cases as indexing only in limited cases gets rid of bounds checking.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org