mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 00:56:31 +08:00
Add benchmark for zero-copy pandas deserialization
This commit is contained in:
1 parent
e12cd72187
commit
c551ed6c32
2 files changed
+20
-2
No files matched your search
@@ -41,8 +41,6 @@ First you have to install ASV's development version:
|
||||
pip install git+https://github.com/airspeed-velocity/asv.git
|
||||
```
|
||||
|
||||
<!--- TODO remove the above once https://github.com/airspeed-velocity/asv/pull/611 is merged -->
|
||||
|
||||
Then you need to set up a few environment variables:
|
||||
|
||||
```shell
|
||||
|
||||
@@ -48,3 +48,23 @@ class PandasConversionsFromArrow(PandasConversionsBase):
|
||||
|
||||
def time_to_series(self, n, dtype):
|
||||
self.arrow_data.to_pandas()
|
||||
|
||||
|
||||
class ZeroCopyPandasRead(object):
|
||||
|
||||
def setup(self):
|
||||
# Transpose to make column-major
|
||||
values = np.random.randn(10, 100000)
|
||||
|
||||
df = pd.DataFrame(values.T)
|
||||
ctx = pa.default_serialization_context()
|
||||
|
||||
self.serialized = ctx.serialize(df)
|
||||
self.as_buffer = self.serialized.to_buffer()
|
||||
self.as_components = self.serialized.to_components()
|
||||
|
||||
def time_deserialize_from_buffer(self):
|
||||
pa.deserialize(self.as_buffer)
|
||||
|
||||
def time_deserialize_from_components(self):
|
||||
pa.deserialize_components(self.as_components)
|
||||
Reference in new issue
Block a user