Skip to content

Commit

Permalink
Benchmark decimal option in read_csv for c engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Camilo Cota committed May 22, 2016
1 parent 9f42d0c commit 465272e
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions asv_bench/benchmarks/parser_vb.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ def setup(self):
def time_read_csv_default_converter(self):
read_csv(StringIO(self.data), sep=',', header=None, float_precision=None)


class read_csv_default_converter_with_decimal(object):
goal_time = 0.2

def setup(self):
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 '
self.data = (self.data * 200)

def time_read_csv_default_converter_with_decimal(self):
read_csv(StringIO(self.data), sep=';', header=None,
float_precision=None, decimal=',')


class read_csv_precise_converter(object):
goal_time = 0.2

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


class read_csv_python_engine(object):
class read_csv_default_converter_python_engine(object):
goal_time = 0.2

def setup(self):
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 '
self.data_decimal = (self.data_decimal * 200)
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 '
self.data = (self.data * 200)

def time_read_csv_default_converter_with_decimal(self):
read_csv(StringIO(self.data_decimal), sep=';', header=None, float_precision=None, decimal=',', engine='python')

def time_read_csv_default_converter(self):
read_csv(StringIO(self.data), sep=',', header=None, float_precision=None, engine='python')
read_csv(StringIO(self.data), sep=',', header=None,
float_precision=None, engine='python')


class read_csv_default_converter_with_decimal_python_engine(object):
goal_time = 0.2

def setup(self):
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 '
self.data = (self.data * 200)

def time_read_csv_default_converter_with_decimal(self):
read_csv(StringIO(self.data), sep=';', header=None,
float_precision=None, decimal=',', engine='python')

0 comments on commit 465272e

Please sign in to comment.