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


##########
cpp/src/arrow/tensor_benchmark.cc:
##########
@@ -0,0 +1,72 @@
+// 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"
+#include "arrow/util/benchmark_util.h"
+
+namespace arrow {
+
+template <typename ValueType>
+static void BatchToTensorSimple(benchmark::State& state) {
+  RegressionArgs args(state);
+  std::shared_ptr<DataType> ty = TypeTraits<ValueType>::type_singleton();
+
+  const int64_t kNumRows = args.size;

Review Comment:
   New result, dividing size by `sizeof(CType)`:
   
   ```
   Running 
/var/folders/gw/q7wqd4tx18n_9t4kbkd0bj1m0000gn/T/arrow-archery-wyoew3d4/WORKSPACE/build/release/arrow-tensor-benchmark
   Run on (8 X 24 MHz CPU s)
   CPU Caches:
     L1 Data 64 KiB
     L1 Instruction 128 KiB
     L2 Unified 4096 KiB (x8)
   Load Average: 19.13, 18.37, 12.07
   
-----------------------------------------------------------------------------------------------------
   Benchmark                                           Time             CPU   
Iterations UserCounters...
   
-----------------------------------------------------------------------------------------------------
   BatchToTensorSimple<UInt8Type>/65536           440965 ns       434790 ns     
    1628 bytes_per_second=143.748Mi/s items_per_second=15.073G/s null_percent=0 
size=65.536k
   BatchToTensorSimple<UInt8Type>/4194304       52116387 ns     39301000 ns     
      18 bytes_per_second=101.779Mi/s items_per_second=10.6723G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<UInt16Type>/65536          422252 ns       421368 ns     
    1663 bytes_per_second=148.326Mi/s items_per_second=7.77658G/s 
null_percent=0 size=65.536k
   BatchToTensorSimple<UInt16Type>/4194304      39602325 ns     36205053 ns     
      19 bytes_per_second=110.482Mi/s items_per_second=5.79243G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<UInt32Type>/65536          411546 ns       411012 ns     
    1696 bytes_per_second=152.064Mi/s items_per_second=3.98625G/s 
null_percent=0 size=65.536k
   BatchToTensorSimple<UInt32Type>/4194304      37668923 ns     35941842 ns     
      19 bytes_per_second=111.291Mi/s items_per_second=2.91742G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<UInt64Type>/65536          409912 ns       409266 ns     
    1772 bytes_per_second=152.712Mi/s items_per_second=2.00163G/s 
null_percent=0 size=65.536k
   BatchToTensorSimple<UInt64Type>/4194304      40266224 ns     36517789 ns     
      19 bytes_per_second=109.536Mi/s items_per_second=1.43571G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<Int8Type>/65536            404307 ns       403876 ns     
    1709 bytes_per_second=154.75Mi/s items_per_second=16.2268G/s null_percent=0 
size=65.536k
   BatchToTensorSimple<Int8Type>/4194304        37406713 ns     35309316 ns     
      19 bytes_per_second=113.285Mi/s items_per_second=11.8787G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<Int16Type>/65536           414663 ns       414136 ns     
    1649 bytes_per_second=150.916Mi/s items_per_second=7.91237G/s 
null_percent=0 size=65.536k
   BatchToTensorSimple<Int16Type>/4194304       37432355 ns     35457526 ns     
      19 bytes_per_second=112.811Mi/s items_per_second=5.91455G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<Int32Type>/65536           413986 ns       413420 ns     
    1706 bytes_per_second=151.178Mi/s items_per_second=3.96304G/s 
null_percent=0 size=65.536k
   BatchToTensorSimple<Int32Type>/4194304       47971980 ns     37791471 ns     
      17 bytes_per_second=105.844Mi/s items_per_second=2.77464G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<Int64Type>/65536           415919 ns       415559 ns     
    1691 bytes_per_second=150.4Mi/s items_per_second=1.97132G/s null_percent=0 
size=65.536k
   BatchToTensorSimple<Int64Type>/4194304       36665862 ns     35319650 ns     
      20 bytes_per_second=113.251Mi/s items_per_second=1.48441G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<HalfFloatType>/65536       422161 ns       421677 ns     
    1685 bytes_per_second=148.218Mi/s items_per_second=7.77088G/s 
null_percent=0 size=65.536k
   BatchToTensorSimple<HalfFloatType>/4194304   35648150 ns     34911650 ns     
      20 bytes_per_second=114.575Mi/s items_per_second=6.00703G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<FloatType>/65536           407051 ns       406626 ns     
    1702 bytes_per_second=153.704Mi/s items_per_second=4.02925G/s 
null_percent=0 size=65.536k
   BatchToTensorSimple<FloatType>/4194304       35324888 ns     34521250 ns     
      20 bytes_per_second=115.871Mi/s items_per_second=3.03748G/s 
null_percent=0 size=4.1943M
   BatchToTensorSimple<DoubleType>/65536          411345 ns       410348 ns     
    1740 bytes_per_second=152.31Mi/s items_per_second=1.99635G/s null_percent=0 
size=65.536k
   BatchToTensorSimple<DoubleType>/4194304      36834741 ns     35409211 ns     
      19 bytes_per_second=112.965Mi/s items_per_second=1.48065G/s 
null_percent=0 size=4.1943M
   ```



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