From 7b7171e478729642dbd5b050389dc4e7b5a838c6 Mon Sep 17 00:00:00 2001 From: Gary Murakami Date: Fri, 11 May 2012 15:19:38 -0400 Subject: [PATCH] Performance test and graphing improvements, includes results and graphs for safe mode, find one, and find many. --- bench/Rakefile | 62 +++ bench/exp_series.html | 578 +++++++++++++++++--- bench/exp_series.rb | 234 ++++---- bench/exp_series_suite_find_c.js | 190 +++++++ bench/exp_series_suite_find_ruby.js | 190 +++++++ bench/exp_series_suite_insert_many_c.js | 590 +++++++++++++++++++++ bench/exp_series_suite_insert_many_ruby.js | 590 +++++++++++++++++++++ bench/exp_series_suite_insert_one_c.js | 190 +++++++ bench/exp_series_suite_insert_one_ruby.js | 190 +++++++ bench/exp_series_suite_nest_c.js | 86 +++ bench/exp_series_suite_nest_ruby.js | 86 +++ 11 files changed, 2805 insertions(+), 181 deletions(-) create mode 100644 bench/Rakefile create mode 100644 bench/exp_series_suite_find_c.js create mode 100644 bench/exp_series_suite_find_ruby.js create mode 100644 bench/exp_series_suite_insert_many_c.js create mode 100644 bench/exp_series_suite_insert_many_ruby.js create mode 100644 bench/exp_series_suite_insert_one_c.js create mode 100644 bench/exp_series_suite_insert_one_ruby.js create mode 100644 bench/exp_series_suite_nest_c.js create mode 100644 bench/exp_series_suite_nest_ruby.js diff --git a/bench/Rakefile b/bench/Rakefile new file mode 100644 index 0000000..4fb7244 --- /dev/null +++ b/bench/Rakefile @@ -0,0 +1,62 @@ +require 'benchmark' + +ENV['MODE'] = 'c' +$suite = { + :suite_insert_one => [ :test_insert_one, :test_insert_one_safe ], + :suite_insert_many => [ :test_insert_many, :test_insert_many_safe ], + :suite_find => [ :test_find_one, :test_find_many ], + :suite_nest => [ :test_insert_one_nest_full, :test_find_one_nest_full ], +} +$date = Time.now.strftime('%Y%m%d-%H%M') + +def suite_series_name(suite) + "exp_series_#{suite}_#{ENV['MODE']}" +end + +def suite_file_name(suite) + suite_series_name(suite) + '.js' +end + +def suite_file_name_temp(suite) + suite_file_name(suite) + '.tmp' +end + +task :default => [:c, :ruby] + +task :c do + ENV['MODE'] = 'c' + $suite.each_key do |key| + Rake::Task[key].invoke + end +end + +task :ruby do + ENV['MODE'] = 'ruby' + $suite.each_key do |suite| + Rake::Task[suite].execute + end +end + +$suite.each do |suite, tests| + tests.each do |t| + task t do + sh "ruby exp_series.rb --file #{suite_file_name_temp(suite)} --mode #{ENV['MODE']} --tag #{suite} -- --name #{t}" + end + end + + desc "#{suite} - #{$suite[suite].join(', ')}" + task suite do |t| + File.open(suite_file_name_temp(suite), 'w'){|f| f.puts("#{suite_series_name(suite)} = [")} + btms = Benchmark.measure do + $suite[suite].each do |pre| + Rake::Task[pre].execute + end + end + File.open(suite_file_name_temp(suite), 'a'){|f| f.puts("]; // #{(btms.real/60.0).round} minutes")} + sh "mv #{suite_file_name_temp(suite)} #{suite_file_name(suite)}" + end +end + +task :clobber do + sh "rm -f exp_series_suite_*.js" +end \ No newline at end of file diff --git a/bench/exp_series.html b/bench/exp_series.html index a780003..f50a2e7 100644 --- a/bench/exp_series.html +++ b/bench/exp_series.html @@ -7,26 +7,40 @@ - + + + + + + + +