[DRE-commits] [ruby-org] 152/303: Adding some benchmarks using org-babel
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:33:48 UTC 2013
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository ruby-org.
commit 0e120d52cdfd064a163c29820f8aebe2edce4608
Author: Waldemar Quevedo <waldemar.quevedo at gmail.com>
Date: Sun Jun 17 23:51:13 2012 +0900
Adding some benchmarks using org-babel
---
bench/Gemfile | 4 +
bench/Gemfile_6_0 | 3 +
bench/Gemfile_6_1 | 3 +
bench/Gemfile_6_2 | 3 +
bench/Gemfile_6_3 | 3 +
bench/Gemfile_redcarpet | 3 +
bench/bench.org | 291 +++++++++++++++++++++++++++++++++++++++
bench/parsing_redcarpet_test.rb | 19 +++
bench/parsing_test.rb | 41 ++++++
9 files changed, 370 insertions(+)
diff --git a/bench/Gemfile b/bench/Gemfile
new file mode 100644
index 0000000..90e56c9
--- /dev/null
+++ b/bench/Gemfile
@@ -0,0 +1,4 @@
+source :rubygems
+
+# Bench with the current version in development
+gem 'org-ruby', :path => '..'
diff --git a/bench/Gemfile_6_0 b/bench/Gemfile_6_0
new file mode 100644
index 0000000..9eee605
--- /dev/null
+++ b/bench/Gemfile_6_0
@@ -0,0 +1,3 @@
+source :rubygems
+
+gem 'org-ruby', '0.6.0'
diff --git a/bench/Gemfile_6_1 b/bench/Gemfile_6_1
new file mode 100644
index 0000000..f497775
--- /dev/null
+++ b/bench/Gemfile_6_1
@@ -0,0 +1,3 @@
+source :rubygems
+
+gem 'org-ruby', '0.6.1'
diff --git a/bench/Gemfile_6_2 b/bench/Gemfile_6_2
new file mode 100644
index 0000000..e383422
--- /dev/null
+++ b/bench/Gemfile_6_2
@@ -0,0 +1,3 @@
+source :rubygems
+
+gem 'org-ruby', '0.6.2'
diff --git a/bench/Gemfile_6_3 b/bench/Gemfile_6_3
new file mode 100644
index 0000000..63df766
--- /dev/null
+++ b/bench/Gemfile_6_3
@@ -0,0 +1,3 @@
+source :rubygems
+
+gem 'org-ruby', '0.6.3'
diff --git a/bench/Gemfile_redcarpet b/bench/Gemfile_redcarpet
new file mode 100644
index 0000000..eebe925
--- /dev/null
+++ b/bench/Gemfile_redcarpet
@@ -0,0 +1,3 @@
+source :rubygems
+
+gem 'redcarpet'
diff --git a/bench/bench.org b/bench/bench.org
new file mode 100644
index 0000000..e5cdcd1
--- /dev/null
+++ b/bench/bench.org
@@ -0,0 +1,291 @@
+* OrgRuby benchmarks
+** How to run the benchmarks (or trying out org-babel)
+
+Within this folder there is a =parsing_test.rb= script which can be used
+to profile a quick benchmark of the current performance of the org-ruby library.
+
+What follows are the results of my benchmark by using the built-in support
+for org-babel included in Emacs 24. (press C-c C-c when over the block to update the benchmark)
+
+** Platform: 1.8.7
+
+For some reason performance is a bit better when using Ruby 1.8.7
+than when using 1.9.2.
+
+*** OrgRuby 0.6.0
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+rvm use 1.8.7 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_6_0" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_6_0" bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.0 with Ruby 1.8.7
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 1.820000 0.040000 1.860000 ( 1.894356)
+: ------------------------------------------ total: 1.860000sec
+:
+: user system total real
+: html conversion 1.840000 0.010000 1.850000 ( 1.878953)
+
+*** OrgRuby 0.6.2
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+rvm use 1.8.7 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_6_2" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_6_2" bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.2 with Ruby 1.8.7
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 2.060000 0.030000 2.090000 ( 2.123677)
+: ------------------------------------------ total: 2.090000sec
+:
+: user system total real
+: html conversion 2.080000 0.030000 2.110000 ( 2.135976)
+
+*** OrgRuby 0.6.3
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+rvm use 1.8.7 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_6_3" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_6_3" bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.3 with Ruby 1.8.7
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 2.060000 0.040000 2.100000 ( 2.126579)
+: ------------------------------------------ total: 2.100000sec
+:
+: user system total real
+: html conversion 2.090000 0.030000 2.120000 ( 2.139272)
+
+*** DEV
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+rvm use 1.8.7 > /dev/null
+rvm info | grep full_version
+bundle install > /dev/null
+bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.3 with Ruby 1.8.7
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 2.050000 0.030000 2.080000 ( 2.147836)
+: ------------------------------------------ total: 2.080000sec
+:
+: user system total real
+: html conversion 2.050000 0.030000 2.080000 ( 2.102787)
+
+** Platform: 1.9.2
+
+Remember that 1.9.2 is sensible to encoding issues. (e.g. あいうえお)
+
+*** OrgRuby 0.6.0
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+export LANG=en_US.UTF-8
+rvm use 1.9.2 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_6_0" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_6_0" bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.0 with Ruby 1.9.2
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 3.250000 0.020000 3.270000 ( 3.313767)
+: ------------------------------------------ total: 3.270000sec
+:
+: user system total real
+: html conversion 3.220000 0.020000 3.240000 ( 3.307011)
+
+*** OrgRuby 0.6.2
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+export LANG=en_US.UTF-8
+rvm use 1.9.2 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_6_2" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_6_2" bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.2 with Ruby 1.9.2
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 3.440000 0.030000 3.470000 ( 3.529776)
+: ------------------------------------------ total: 3.470000sec
+:
+: user system total real
+: html conversion 3.440000 0.030000 3.470000 ( 3.519090)
+
+*** OrgRuby 0.6.3
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+export LANG=en_US.UTF-8
+rvm use 1.9.2 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_6_3" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_6_3" bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.3 with Ruby 1.9.2
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 3.430000 0.030000 3.460000 ( 3.526293)
+: ------------------------------------------ total: 3.460000sec
+:
+: user system total real
+: html conversion 3.440000 0.030000 3.470000 ( 3.525800)
+
+*** DEV
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+export LANG=en_US.UTF-8
+rvm use 1.9.2 > /dev/null
+rvm info | grep full_version
+bundle install > /dev/null
+bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.3 with Ruby 1.9.2
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 3.380000 0.020000 3.400000 ( 3.469689)
+: ------------------------------------------ total: 3.400000sec
+:
+: user system total real
+: html conversion 3.380000 0.030000 3.410000 ( 3.441502)
+
+** Platform: 1.9.3
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+export LANG=en_US.UTF-8
+rvm use 1.9.3 > /dev/null
+rvm info | grep full_version
+bundle install > /dev/null
+bundle exec ruby parsing_test.rb
+#+END_SRC
+
+#+RESULTS:
+: full_version: "ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]"
+: Running benchmark with OrgRuby version 0.6.3 with Ruby 1.9.3
+: Parsing 30 times
+: Rehearsal ---------------------------------------------------
+: html conversion 3.810000 0.020000 3.830000 ( 3.960345)
+: ------------------------------------------ total: 3.830000sec
+:
+: user system total real
+: html conversion 3.790000 0.020000 3.810000 ( 3.848413)
+
+** Other benchmarks
+*** Similar benchmark using other markup libraries
+**** Markdown using Redcarpet in Ruby 1.8.7
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+rvm use 1.8.7 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_redcarpet" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_redcarpet" bundle exec ruby parsing_redcarpet_test.rb
+#+END_SRC
+
+#+RESULTS:
+#+begin_example
+ full_version: "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.2.0]"
+Running benchmark with RedCarpet with Ruby 1.8.7 (n=30)
+Parsing 30 times
+Rehearsal ------------------------------------------------------------------
+html conversion with Redcarpet 0.010000 0.000000 0.010000 ( 0.007885)
+--------------------------------------------------------- total: 0.010000sec
+
+ user system total real
+html conversion with Redcarpet 0.010000 0.000000 0.010000 ( 0.007482)
+ 0.010000 0.000000 0.010000 ( 0.007482)
+#+end_example
+
+**** Markdown using Redcarpet in Ruby 1.9.2
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+rvm use 1.9.2 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_redcarpet" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_redcarpet" bundle exec ruby parsing_redcarpet_test.rb
+#+END_SRC
+
+#+RESULTS:
+#+begin_example
+ full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]"
+Running benchmark with RedCarpet with Ruby 1.9.2 (n=30)
+Parsing 30 times
+Rehearsal ------------------------------------------------------------------
+html conversion with Redcarpet 0.010000 0.000000 0.010000 ( 0.007588)
+--------------------------------------------------------- total: 0.010000sec
+
+ user system total real
+html conversion with Redcarpet 0.010000 0.000000 0.010000 ( 0.007063)
+ 0.010000 0.000000 0.010000 ( 0.007063)
+#+end_example
+
+**** Markdown using Redcarpet in Ruby 1.9.3
+
+#+BEGIN_SRC sh :results verbatim
+source ~/.bashrc
+rvm use 1.9.3 > /dev/null
+rvm info | grep full_version
+BUNDLE_GEMFILE="Gemfile_redcarpet" bundle install > /dev/null
+BUNDLE_GEMFILE="Gemfile_redcarpet" bundle exec ruby parsing_redcarpet_test.rb
+#+END_SRC
+
+#+RESULTS:
+#+begin_example
+ full_version: "ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]"
+Running benchmark with RedCarpet with Ruby 1.9.3 (n=30)
+Parsing 30 times
+Rehearsal ------------------------------------------------------------------
+html conversion with Redcarpet 0.010000 0.000000 0.010000 ( 0.007438)
+--------------------------------------------------------- total: 0.010000sec
+
+ user system total real
+html conversion with Redcarpet 0.010000 0.000000 0.010000 ( 0.006909)
+ 0.010000 0.000000 0.010000 ( 0.006909)
+#+end_example
+
+*** TODO Encoding benchmarks
+
+**** Not setting default Encoding
+**** Setting Encoding::UTF_8 as default
+**** Setting Encoding::ASCII_8BIT as default
diff --git a/bench/parsing_redcarpet_test.rb b/bench/parsing_redcarpet_test.rb
new file mode 100644
index 0000000..868d4eb
--- /dev/null
+++ b/bench/parsing_redcarpet_test.rb
@@ -0,0 +1,19 @@
+require 'redcarpet'
+require 'benchmark'
+
+def run_benchmark(n=30)
+ org_content = File.open('bench.org').read
+
+ puts "Parsing #{n} times"
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
+ Benchmark.bmbm do |x|
+ x.report('html conversion with Redcarpet') do
+ n.times do
+ markdown.render(org_content)
+ end
+ end
+ end
+end
+
+puts "Running benchmark with RedCarpet with Ruby #{RUBY_VERSION} (n=30)"
+run_benchmark
diff --git a/bench/parsing_test.rb b/bench/parsing_test.rb
new file mode 100644
index 0000000..ba04830
--- /dev/null
+++ b/bench/parsing_test.rb
@@ -0,0 +1,41 @@
+require 'org-ruby'
+require 'benchmark'
+
+def run_html_output_benchmark(n=30)
+ org_content = File.open('bench.org').read
+
+ puts "Parsing #{n} times"
+ Benchmark.bmbm do |x|
+
+ x.report('html conversion') do
+ n.times do
+ Orgmode::Parser.new(org_content).to_html
+ end
+ end
+ end
+end
+
+def run_textile_output_benchmark(n=30)
+ org_content = File.open('bench.org').read
+
+ puts "Parsing #{n} times"
+ x.report('textile conversion') do
+ n.times do
+ Orgmode::Parser.new(content).to_textile
+ end
+ end
+end
+
+def run_parsing_file_benchmark(n=30)
+ puts "Parsing #{n} times"
+ x.report('textile conversion') do
+ n.times do
+ Orgmode::Parser.load('bench.org')
+ end
+ end
+end
+
+puts "Running benchmark using OrgRuby version #{OrgRuby::VERSION} with Ruby #{RUBY_VERSION}"
+run_html_output_benchmark
+# run_textile_output_benchmark
+# run_parsing_file_benchmark
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-org.git
More information about the Pkg-ruby-extras-commits
mailing list