[ 
https://issues.apache.org/jira/browse/ARROW-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16348920#comment-16348920
 ] 

ASF GitHub Bot commented on ARROW-1861:
---------------------------------------

cpcloud commented on a change in pull request #1543: ARROW-1861: [Python] 
Rework benchmark suite [skip ci]
URL: https://github.com/apache/arrow/pull/1543#discussion_r165422542
 
 

 ##########
 File path: python/benchmarks/array_ops.py
 ##########
 @@ -0,0 +1,34 @@
+# 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.
+
+import numpy as np
+import pyarrow as pa
+
+
+class ScalarAccess(object):
+    n = 10 ** 5
+
+    def setUp(self):
+        self._array = pa.array(list(range(self.n)), type=pa.int64())
+
+    def time_getitem(self):
+        for i in range(self.n):
+            self._array[i]
+
+    def time_getitem_as_py(self):
+        for i in range(self.n):
+            self._array[i].as_py()
 
 Review comment:
   I wonder if this should loop over the array with elements already indexed so 
that we don't have to compute the difference between `time_getitem` and 
`time_getitem_as_py` to see the overhead of `as_py`. Something like
   
   ```python
   for el in self._array2:
       el.as_py()
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [Python] Fix up ASV setup, add developer instructions for writing new 
> benchmarks and running benchmark suite locally
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-1861
>                 URL: https://issues.apache.org/jira/browse/ARROW-1861
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Wes McKinney
>            Assignee: Antoine Pitrou
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>
> We need to start writing more microbenchmarks as we go to prevent 
> unintentional performance regressions (this has been a constant thorn in my 
> side for years: 
> http://wesmckinney.com/blog/introducing-vbench-new-code-performance-analysis-and-monitoring-tool/).
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to