Skip to content

Commit 2bdb535

Browse files
authored
BENCH: fix misleading json asvs (#43063)
1 parent 7376b36 commit 2bdb535

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

asv_bench/benchmarks/io/json.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,19 @@ def time_to_json(self, orient, frame):
172172
def peakmem_to_json(self, orient, frame):
173173
getattr(self, frame).to_json(self.fname, orient=orient)
174174

175-
def time_to_json_wide(self, orient, frame):
175+
176+
class ToJSONWide(ToJSON):
177+
def setup(self, orient, frame):
178+
super().setup(orient, frame)
176179
base_df = getattr(self, frame).copy()
177-
df = concat([base_df.iloc[:100]] * 1000, ignore_index=True, axis=1)
178-
df.to_json(self.fname, orient=orient)
180+
df_wide = concat([base_df.iloc[:100]] * 1000, ignore_index=True, axis=1)
181+
self.df_wide = df_wide
182+
183+
def time_to_json_wide(self, orient, frame):
184+
self.df_wide.to_json(self.fname, orient=orient)
179185

180186
def peakmem_to_json_wide(self, orient, frame):
181-
base_df = getattr(self, frame).copy()
182-
df = concat([base_df.iloc[:100]] * 1000, ignore_index=True, axis=1)
183-
df.to_json(self.fname, orient=orient)
187+
self.df_wide.to_json(self.fname, orient=orient)
184188

185189

186190
class ToJSONISO(BaseIO):

0 commit comments

Comments
 (0)