jorisvandenbossche commented on code in PR #40358:
URL: https://github.com/apache/arrow/pull/40358#discussion_r1515763364


##########
cpp/src/arrow/to_tensor_benchmark.cc:
##########
@@ -0,0 +1,68 @@
+// 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.
+
+#include "benchmark/benchmark.h"
+
+#include "arrow/record_batch.h"
+#include "arrow/testing/gtest_util.h"
+#include "arrow/testing/random.h"
+#include "arrow/type.h"
+
+namespace arrow {
+
+template <typename ValueType>
+static void BatchToTensorSimple(benchmark::State& state) {
+  std::shared_ptr<DataType> ty = TypeTraits<ValueType>::type_singleton();
+  auto f0 = field("f0", ty);
+  auto f1 = field("f1", ty);
+  auto f2 = field("f2", ty);
+
+  std::vector<std::shared_ptr<Field>> fields = {f0, f1, f2};
+  auto schema = ::arrow::schema(fields);
+
+  constexpr int kNumRows = 500;

Review Comment:
   I think you can go with something much bigger, like 100k



##########
cpp/src/arrow/to_tensor_benchmark.cc:
##########
@@ -0,0 +1,68 @@
+// 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.
+
+#include "benchmark/benchmark.h"
+
+#include "arrow/record_batch.h"
+#include "arrow/testing/gtest_util.h"
+#include "arrow/testing/random.h"
+#include "arrow/type.h"
+
+namespace arrow {
+
+template <typename ValueType>
+static void BatchToTensorSimple(benchmark::State& state) {
+  std::shared_ptr<DataType> ty = TypeTraits<ValueType>::type_singleton();
+  auto f0 = field("f0", ty);
+  auto f1 = field("f1", ty);
+  auto f2 = field("f2", ty);
+
+  std::vector<std::shared_ptr<Field>> fields = {f0, f1, f2};
+  auto schema = ::arrow::schema(fields);
+
+  constexpr int kNumRows = 500;

Review Comment:
   And maybe also more columns. We could also define a total number of 
elements, and then test with multiple number of columns (eg 10 and 100) and 
calculate the the number of rows from that



##########
cpp/src/arrow/to_tensor_benchmark.cc:
##########


Review Comment:
   To keep with naming conventions, maybe call this `tensor_benchmark.cc`? (so 
that it's next to a `tensor.cc`, which will be correct when we move the code 
there)



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to