Skip to content

Commit 465272e

Browse files
author
Camilo Cota
committed
Benchmark decimal option in read_csv for c engine
1 parent 9f42d0c commit 465272e

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

asv_bench/benchmarks/parser_vb.py

+28-7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ def setup(self):
2929
def time_read_csv_default_converter(self):
3030
read_csv(StringIO(self.data), sep=',', header=None, float_precision=None)
3131

32+
33+
class read_csv_default_converter_with_decimal(object):
34+
goal_time = 0.2
35+
36+
def setup(self):
37+
self.data = '0,1213700904466425978256438611;0,0525708283766902484401839501;0,4174092731488769913994474336\n 0,4096341697147408700274695547;0,1587830198973579909349496119;0,1292545832485494372576795285\n 0,8323255650024565799327547210;0,9694902427379478160318626578;0,6295047811546814475747169126\n 0,4679375305798131323697930383;0,2963942381834381301075609371;0,5268936082160610157032465394\n 0,6685382761849776311890991564;0,6721207066140679753374342908;0,6519975277021627935170045020\n '
38+
self.data = (self.data * 200)
39+
40+
def time_read_csv_default_converter_with_decimal(self):
41+
read_csv(StringIO(self.data), sep=';', header=None,
42+
float_precision=None, decimal=',')
43+
44+
3245
class read_csv_precise_converter(object):
3346
goal_time = 0.2
3447

@@ -111,17 +124,25 @@ def time_read_table_multiple_date_baseline(self):
111124
read_table(StringIO(self.data), sep=',', header=None, parse_dates=[1])
112125

113126

114-
class read_csv_python_engine(object):
127+
class read_csv_default_converter_python_engine(object):
115128
goal_time = 0.2
116129

117130
def setup(self):
118-
self.data_decimal = '0,1213700904466425978256438611;0,0525708283766902484401839501;0,4174092731488769913994474336\n 0,4096341697147408700274695547;0,1587830198973579909349496119;0,1292545832485494372576795285\n 0,8323255650024565799327547210;0,9694902427379478160318626578;0,6295047811546814475747169126\n 0,4679375305798131323697930383;0,2963942381834381301075609371;0,5268936082160610157032465394\n 0,6685382761849776311890991564;0,6721207066140679753374342908;0,6519975277021627935170045020\n '
119-
self.data_decimal = (self.data_decimal * 200)
120131
self.data = '0.1213700904466425978256438611,0.0525708283766902484401839501,0.4174092731488769913994474336\n 0.4096341697147408700274695547,0.1587830198973579909349496119,0.1292545832485494372576795285\n 0.8323255650024565799327547210,0.9694902427379478160318626578,0.6295047811546814475747169126\n 0.4679375305798131323697930383,0.2963942381834381301075609371,0.5268936082160610157032465394\n 0.6685382761849776311890991564,0.6721207066140679753374342908,0.6519975277021627935170045020\n '
121132
self.data = (self.data * 200)
122133

123-
def time_read_csv_default_converter_with_decimal(self):
124-
read_csv(StringIO(self.data_decimal), sep=';', header=None, float_precision=None, decimal=',', engine='python')
125-
126134
def time_read_csv_default_converter(self):
127-
read_csv(StringIO(self.data), sep=',', header=None, float_precision=None, engine='python')
135+
read_csv(StringIO(self.data), sep=',', header=None,
136+
float_precision=None, engine='python')
137+
138+
139+
class read_csv_default_converter_with_decimal_python_engine(object):
140+
goal_time = 0.2
141+
142+
def setup(self):
143+
self.data = '0,1213700904466425978256438611;0,0525708283766902484401839501;0,4174092731488769913994474336\n 0,4096341697147408700274695547;0,1587830198973579909349496119;0,1292545832485494372576795285\n 0,8323255650024565799327547210;0,9694902427379478160318626578;0,6295047811546814475747169126\n 0,4679375305798131323697930383;0,2963942381834381301075609371;0,5268936082160610157032465394\n 0,6685382761849776311890991564;0,6721207066140679753374342908;0,6519975277021627935170045020\n '
144+
self.data = (self.data * 200)
145+
146+
def time_read_csv_default_converter_with_decimal(self):
147+
read_csv(StringIO(self.data), sep=';', header=None,
148+
float_precision=None, decimal=',', engine='python')

0 commit comments

Comments
 (0)