Add benchmarks for object deduplication

Change-Id: I834e91d6a2474bfc67c504dc1bd0497c08869563
This commit is contained in:
Wes McKinney committed 2018-12-26 14:27:36 -06:00
1 parent ca88b96396
commit a00b51c704
2 files changed
+26 -1

No files matched your search

+21
View File
@@ -17,6 +17,8 @@
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pyarrow as pa
@@ -50,6 +52,25 @@ class PandasConversionsFromArrow(PandasConversionsBase):
self.arrow_data.to_pandas()
class ToPandasStrings(object):
params = ((100, 10000, 100000, 500000),)
string_length = 25
num_elements = 1000 * 1000
def setup(self, nunique):
unique_values = [tm.rands(self.string_length) for i in range(nunique)]
values = unique_values * (self.num_elements // nunique)
self.arr = pa.array(values, type=pa.string())
self.table = pa.Table.from_arrays([self.arr], ['f0'])
def time_to_pandas_dedup(self, nunique):
self.arr.to_pandas()
def time_to_pandas_no_dedup(self, nunique):
self.arr.to_pandas(deduplicate_objects=False)
class ZeroCopyPandasRead(object):
def setup(self):
+5 -1
View File
@@ -192,11 +192,15 @@ def _iterate_python_module_paths(package_name):
for finder in sys.meta_path:
try:
spec = finder.find_spec(absolute_name, None)
except AttributeError:
except (AttributeError, TypeError):
# On Travis (Python 3.5) the above produced:
# AttributeError: 'VendorImporter' object has no
# attribute 'find_spec'
#
# ARROW-4117: When running "asv dev", TypeError is raised
# due to the meta-importer
spec = None
if spec is not None:
break