Skip to content

Instantly share code, notes, and snippets.

@Shekharrajak
Created January 25, 2019 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shekharrajak/1355d64888764a9e18fe98572a5e4d1e to your computer and use it in GitHub Desktop.
Save Shekharrajak/1355d64888764a9e18fe98572a5e4d1e to your computer and use it in GitHub Desktop.
require_relative 'benchmarker'
$:.unshift File.expand_path("../../../lib", __FILE__)
DF_SIZE_POW_10 = [2, 3, 4, 5, 6, 7]
DF_SIZE_POW_10.each do |df_size|
puts "DataFrame of size : #{10**df_size} "
Benchmarker.benchmark_create_df(10**df_size)
Benchmarker.benchmark_mean()
Benchmarker.benchmark_mode()
Benchmarker.benchmark_median()
Benchmarker.benchmark_sum()
Benchmarker.benchmark_product()
Benchmarker.benchmark_median_absolute_deviation()
Benchmarker.benchmark_sum_of_squared_deviation()
Benchmarker.benchmark_average_deviation_population()
Benchmarker.benchmark_unique()
puts
end
# Benchmarker.result_with_size() Uncomment it to see only Daru::Vector benchmark.
Benchmarker.result_compare()
# Real times for vector size [10**2, 10**3,10**4,10**5,10**6]
# Means => ["0.000059782999", "0.000039732000", "0.000049370999", "0.000053350000", "0.000069114000", "0.000059550001"]
# mode => ["0.000362311001", "0.000497481001", "0.000375471000", "0.000315499000", "0.000498609000", "0.000256725000"]
# median => ["0.000163064999", "0.000179371000", "0.000113426000", "0.000117927000", "0.000157335000", "0.000120525000"]
# sum => ["0.000028036000", "0.000106457000", "0.000024055000", "0.000025545000", "0.000035602000", "0.000027020000"]
# product => ["0.000023257000", "0.000037252000", "0.000021918000", "0.000022294000", "0.000033712000", "0.000022573000"]
# median_absolute_deviation => ["0.000228032000", "0.000427085000", "0.000212802001", "0.000227248000", "0.000321677000", "0.000218785000"]
# sum_of_squared_deviation => ["0.000048617000", "0.000063766000", "0.000039721001", "0.000120714000", "0.000052445000", "0.000040694000"]
# average_deviation_populationa => ["0.000117892000", "0.000167791000", "0.000102102000", "0.000105429001", "0.000140446000", "0.000159499999"]
# create df real time => ["0.001020248000", "0.010377509000", "0.120133259000", "0.988936126000", "10.624304956000", "160.231077512000"]
# MEAN
# Number of rows | Real Time
# 10 ** 2 | 0.000054331000
# 10 ** 3 | 0.000009194999
# 10 ** 4 | 0.000018446000
# 10 ** 5 | 0.000020922002
# 10 ** 6 | 0.000021750000
# 10 ** 7 | 0.000025256000
# mode
# Number of rows | Real Time
# 10 ** 2 | 0.000149911999
# 10 ** 3 | 0.000142830000
# 10 ** 4 | 0.000075880000
# 10 ** 5 | 0.000102595999
# 10 ** 6 | 0.000162674000
# 10 ** 7 | 0.000127839001
# median
# Number of rows | Real Time
# 10 ** 2 | 0.000087897999
# 10 ** 3 | 0.000048153001
# 10 ** 4 | 0.000048931000
# 10 ** 5 | 0.000058501999
# 10 ** 6 | 0.000037392001
# 10 ** 7 | 0.000039921000
# sum
# Number of rows | Real Time
# 10 ** 2 | 0.000007932000
# 10 ** 3 | 0.000005886999
# 10 ** 4 | 0.000007730001
# 10 ** 5 | 0.000007742001
# 10 ** 6 | 0.000007914001
# 10 ** 7 | 0.000008490000
# product
# Number of rows | Real Time
# 10 ** 2 | 0.000008676001
# 10 ** 3 | 0.000023701001
# 10 ** 4 | 0.000008835001
# 10 ** 5 | 0.000006949000
# 10 ** 6 | 0.000007162000
# 10 ** 7 | 0.000008034000
# median_absolute_deviation
# Number of rows | Real Time
# 10 ** 2 | 0.000115168001
# 10 ** 3 | 0.000078445999
# 10 ** 4 | 0.000087135000
# 10 ** 5 | 0.000061999001
# 10 ** 6 | 0.000089991001
# 10 ** 7 | 0.000069404001
# sum_of_squared_deviation
# Number of rows | Real Time
# 10 ** 2 | 0.000011927999
# 10 ** 3 | 0.000027659000
# 10 ** 4 | 0.000011986000
# 10 ** 5 | 0.000011858001
# 10 ** 6 | 0.000012952001
# 10 ** 7 | 0.000013014000
# average_deviation_populationa
# Number of rows | Real Time
# 10 ** 2 | 0.000074686001
# 10 ** 3 | 0.000056527000
# 10 ** 4 | 0.000030231000
# 10 ** 5 | 0.000051306999
# 10 ** 6 | 0.000031907000
# 10 ** 7 | 0.000034154000
# create df real time
# Number of rows | Real Time
# 10 ** 2 | 0.000290951000
# 10 ** 3 | 0.002574505999
# 10 ** 4 | 0.032502977001
# 10 ** 5 | 0.247718948001
# 10 ** 6 | 2.816306391998
# 10 ** 7 | 45.877466839000
# Real times for vector size [10**2, 10**3,10**4,10**5,10**6]
# Method on DataFrame Vector (Vector access and apply method): **MEAN**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00005347399928723462 |
# | 10 ** 3 | 0.00000930299938772805 |
# | 10 ** 4 | 0.00002248199962195940 |
# | 10 ** 5 | 0.00002107299951603636 |
# | 10 ** 6 | 0.00002180799856432714 |
# | 10 ** 7 | 0.00002622999818413518 |
# Method on DataFrame Vector (Vector access and apply method): **mode**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00017478399968240410 |
# | 10 ** 3 | 0.00008010799865587614 |
# | 10 ** 4 | 0.00011613899914664216 |
# | 10 ** 5 | 0.00010050600030808710 |
# | 10 ** 6 | 0.00016179999875021167 |
# | 10 ** 7 | 0.00012378300016280264 |
# Method on DataFrame Vector (Vector access and apply method): **median**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00005261199839878827 |
# | 10 ** 3 | 0.00002682400008779950 |
# | 10 ** 4 | 0.00003368200123077258 |
# | 10 ** 5 | 0.00005748499825131148 |
# | 10 ** 6 | 0.00003802499850280583 |
# | 10 ** 7 | 0.00008999200144899078 |
# Method on DataFrame Vector (Vector access and apply method): **sum**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00000746200021239929 |
# | 10 ** 3 | 0.00000597000325797126 |
# | 10 ** 4 | 0.00000720399839337915 |
# | 10 ** 5 | 0.00000745499710319564 |
# | 10 ** 6 | 0.00005896600123378448 |
# | 10 ** 7 | 0.00000900500162970275 |
# Method on DataFrame Vector (Vector access and apply method): **product**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00002019299790845253 |
# | 10 ** 3 | 0.00000498999725095928 |
# | 10 ** 4 | 0.00000655099938740022 |
# | 10 ** 5 | 0.00000666200139676221 |
# | 10 ** 6 | 0.00000736299989512190 |
# | 10 ** 7 | 0.00000797199754742905 |
# Method on DataFrame Vector (Vector access and apply method): **median_absolute_deviation**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00005985799725749530 |
# | 10 ** 3 | 0.00005071499981568195 |
# | 10 ** 4 | 0.00007257600009324960 |
# | 10 ** 5 | 0.00005898799645365216 |
# | 10 ** 6 | 0.00011886399806826375 |
# | 10 ** 7 | 0.00007509900024160743 |
# Method on DataFrame Vector (Vector access and apply method): **sum_of_squared_deviation**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00002594100078567863 |
# | 10 ** 3 | 0.00000969399843597785 |
# | 10 ** 4 | 0.00001122899993788451 |
# | 10 ** 5 | 0.00001170699761132710 |
# | 10 ** 6 | 0.00006296100036706775 |
# | 10 ** 7 | 0.00001322000025538728 |
# Method on DataFrame Vector (Vector access and apply method): **average_deviation_populationa**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00004264399831299670 |
# | 10 ** 3 | 0.00003976099833380431 |
# | 10 ** 4 | 0.00002845899871317670 |
# | 10 ** 5 | 0.00005149999924469739 |
# | 10 ** 6 | 0.00003221800216124393 |
# | 10 ** 7 | 0.00008974700176622719 |
# Method on DataFrame Vector (Vector access and apply method): **create df real time**
# | Number of rows | Real Time |
# |------------|------------|
# | 10 ** 2 | 0.00029346900191740133 |
# | 10 ** 3 | 0.00270435700076632202 |
# | 10 ** 4 | 0.03130596700066234916 |
# | 10 ** 5 | 0.24355140899933758192 |
# | 10 ** 6 | 2.85959107999951811507 |
# | 10 ** 7 | 52.26341757000045618042 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment