Skip to content

Commit 47c2b5f

Browse files
committed
rewrote added benchmark
1 parent 416035b commit 47c2b5f

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

asv_bench/benchmarks/timeseries.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,25 @@ def time_lookup_and_cleanup(self):
265265

266266
class ToDatetimeFromIntsFloats:
267267
def setup(self):
268-
self.timestamp_seconds_int = Series(
269-
range(1521080307, 1521685107), dtype="int64"
270-
)
271-
self.timestamp_seconds_float = self.timestamp_seconds_int.astype("float64")
268+
self.ts_sec = Series(range(1521080307, 1521685107), dtype="int64")
269+
self.ts_sec_float = self.ts_sec.astype("float64")
270+
271+
self.ts_nanosec = 1_000_000 * self.ts_sec
272+
self.ts_nanosec.float = self.ts_nanosec.astype("float64")
273+
274+
# speed of int64 and float64 paths should be comparable
275+
276+
def time_nanosec_int64(self):
277+
to_datetime(self.ts_nanosec, unit="ns")
278+
279+
def time_nanosec_float64(self):
280+
to_datetime(self.ts_nanosec_float, unit="ns")
272281

273-
def to_datetime_int(self):
274-
to_datetime(self.timestamp_seconds_int, unit="s")
282+
def time_sec_int64(self):
283+
to_datetime(self.ts_sec, unit="s")
275284

276-
# float64 should about the same as int64
277-
def to_datetime_float(self):
278-
to_datetime(self.timestamp_seconds_float, unit="s")
285+
def time_sec_float64(self):
286+
to_datetime(self.ts_sec_float, unit="s")
279287

280288

281289
class ToDatetimeYYYYMMDD:

0 commit comments

Comments
 (0)