Skip to content

Commit

Permalink
4.0 benchmarks (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd authored Jan 14, 2024
1 parent bbdb71e commit e381c9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 29 deletions.
1 change: 1 addition & 0 deletions asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"matrix": {
"pandas": [],
"pip+tableauhyperapi": [],
"pyarrow": [],
},

// Combinations of libraries/python versions can be excluded/included
Expand Down
36 changes: 7 additions & 29 deletions benchmarks/benchmarks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import pandas as pd
from tableauhyperapi import HyperProcess, Telemetry

import pantab

Expand All @@ -21,7 +20,6 @@ def setup(self):
True,
pd.to_datetime("2018-01-01"),
pd.to_datetime("2018-01-01", utc=True),
pd.Timedelta("1 days 2 hours 3 minutes 4 seconds"),
"foo",
]
] * nrows
Expand All @@ -40,7 +38,6 @@ def setup(self):
"bool",
"datetime64",
"datetime64_utc",
"timedelta64",
"object",
],
)
Expand All @@ -55,60 +52,41 @@ def setup(self):
"bool": bool,
"datetime64": "datetime64[ns]",
"datetime64_utc": "datetime64[ns, UTC]",
"timedelta64": "timedelta64[ns]",
"object": "object",
}
)

path = "test.hyper"
pantab.frame_to_hyper(df, path, table="test")
self.hyper = HyperProcess(Telemetry.DO_NOT_SEND_USAGE_DATA_TO_TABLEAU)

return df

def teardown(self):
self.hyper.close()

def time_write_frame(self):
pantab.frame_to_hyper(
self.df, "dummy.hyper", table="dummy", hyper_process=self.hyper
)
pantab.frame_to_hyper(self.df, "dummy.hyper", table="dummy")

def time_read_frame(self):
pantab.frame_from_hyper("test.hyper", table="test", hyper_process=self.hyper)
pantab.frame_from_hyper("test.hyper", table="test")


class TimeWriteLong:
def setup(self):
self.hyper = HyperProcess(Telemetry.DO_NOT_SEND_USAGE_DATA_TO_TABLEAU)
self.df = pd.DataFrame(np.ones((10_000_000, 1)), columns=["a"])

def teardown(self):
self.hyper.close()

def time_write_frame(self):
pantab.frame_to_hyper(
self.df, "dummy.hyper", table="dummy", hyper_process=self.hyper
)
pantab.frame_to_hyper(self.df, "dummy.hyper", table="dummy")

def peakmem_write_frame(self):
pantab.frame_to_hyper(
self.df, "dummy.hyper", table="dummy", hyper_process=self.hyper
)
pantab.frame_to_hyper(self.df, "dummy.hyper", table="dummy")


class TimeReadLong:
def setup(self):
df = pd.DataFrame(np.ones((10_000_000, 1)), columns=["a"])
path = "test.hyper"
self.hyper = HyperProcess(Telemetry.DO_NOT_SEND_USAGE_DATA_TO_TABLEAU)
pantab.frame_to_hyper(df, path, table="test", hyper_process=self.hyper)

def teardown(self):
self.hyper.close()
pantab.frame_to_hyper(df, path, table="test")

def time_read_frame(self):
pantab.frame_from_hyper("test.hyper", table="test", hyper_process=self.hyper)
pantab.frame_from_hyper("test.hyper", table="test")

def peakmem_read_frame(self):
pantab.frame_from_hyper("test.hyper", table="test", hyper_process=self.hyper)
pantab.frame_from_hyper("test.hyper", table="test")

0 comments on commit e381c9a

Please sign in to comment.