[前][次][番号順一覧][スレッド一覧]

ruby-changes:51729

From: k0kubun <ko1@a...>
Date: Wed, 11 Jul 2018 00:58:57 +0900 (JST)
Subject: [ruby-changes:51729] k0kubun:r63941 (trunk): benchmark: revise ERB benchmarks using YAML syntax

k0kubun	2018-07-11 00:58:52 +0900 (Wed, 11 Jul 2018)

  New Revision: 63941

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63941

  Log:
    benchmark: revise ERB benchmarks using YAML syntax
    
    to improve the accuracy of measurement by stop using block.
    
    benchmark/app_erb.rb -> benchmark/app_erb.yml: renamed and revised
    benchmark/erb_render.rb -> benchmark/erb_render.yml: ditto
    
    benchmark/README.md: follow renames

  Added files:
    trunk/benchmark/app_erb.yml
    trunk/benchmark/erb_render.yml
  Removed files:
    trunk/benchmark/app_erb.rb
    trunk/benchmark/erb_render.rb
  Modified files:
    trunk/benchmark/README.md
Index: benchmark/erb_render.rb
===================================================================
--- benchmark/erb_render.rb	(revision 63940)
+++ benchmark/erb_render.rb	(nonexistent)
@@ -1,25 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/erb_render.rb#L0
-require 'erb'
-
-data = <<erb
-<html>
-  <head> <%= title %> </head>
-  <body>
-    <h1> <%= title %> </h1>
-    <p>
-      <%= content %>
-    </p>
-  </body>
-</html>
-erb
-
-max = 1_500_000
-title = "hello world!"
-content = "hello world!\n" * 10
-
-src = "def self.render(title, content); #{ERB.new(data).src}; end"
-mod = Module.new
-mod.instance_eval(src, "(ERB)")
-
-max.times do
-  mod.render(title, content)
-end

Property changes on: benchmark/erb_render.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/app_erb.rb
===================================================================
--- benchmark/app_erb.rb	(revision 63940)
+++ benchmark/app_erb.rb	(nonexistent)
@@ -1,25 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/app_erb.rb#L0
-#
-# Create many HTML strings with ERB.
-#
-
-require 'erb'
-
-data = <<erb
-<html>
-  <head> <%= title %> </head>
-  <body>
-    <h1> <%= title %> </h1>
-    <p>
-      <%= content %>
-    </p>
-  </body>
-</html>
-erb
-
-max = 15_000
-title = "hello world!"
-content = "hello world!\n" * 10
-
-max.times{
-  ERB.new(data).result(binding)
-}

Property changes on: benchmark/app_erb.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/erb_render.yml
===================================================================
--- benchmark/erb_render.yml	(nonexistent)
+++ benchmark/erb_render.yml	(revision 63941)
@@ -0,0 +1,24 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/erb_render.yml#L1
+prelude: |
+  require 'erb'
+
+  data = <<erb
+  <html>
+    <head> <%= title %> </head>
+    <body>
+      <h1> <%= title %> </h1>
+      <p>
+        <%= content %>
+      </p>
+    </body>
+  </html>
+  erb
+
+  title = "hello world!"
+  content = "hello world!\n" * 10
+
+  src = "def self.render(title, content); #{ERB.new(data).src}; end"
+  mod = Module.new
+  mod.instance_eval(src, "(ERB)")
+benchmark:
+  erb_render: mod.render(title, content)
+loop_count: 1500000
Index: benchmark/app_erb.yml
===================================================================
--- benchmark/app_erb.yml	(nonexistent)
+++ benchmark/app_erb.yml	(revision 63941)
@@ -0,0 +1,24 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/app_erb.yml#L1
+#
+# Create many HTML strings with ERB.
+#
+prelude: |
+  require 'erb'
+
+  data = <<erb
+  <html>
+    <head> <%= title %> </head>
+    <body>
+      <h1> <%= title %> </h1>
+      <p>
+        <%= content %>
+      </p>
+    </body>
+  </html>
+  erb
+
+  max = 15_000
+  title = "hello world!"
+  content = "hello world!\n" * 10
+benchmark:
+  app_erb: ERB.new(data).result(binding)
+loop_count: 15000
Index: benchmark/README.md
===================================================================
--- benchmark/README.md	(revision 63940)
+++ benchmark/README.md	(revision 63941)
@@ -9,7 +9,7 @@ Execute `gem install benchmark_driver` a https://github.com/ruby/ruby/blob/trunk/benchmark/README.md#L9
 
 ```bash
 # Run a benchmark script with the ruby in the $PATH
-benchmark-driver benchmark/erb_render.rb
+benchmark-driver benchmark/erb_fib.rb
 
 # Run all benchmark scripts with multiple Ruby executables or options
 benchmark-driver benchmark/*.yml -e /path/to/ruby -e '/path/to/ruby --jit'
@@ -59,7 +59,7 @@ make benchmark ITEM=vm1 OPTS=--filter=bl https://github.com/ruby/ruby/blob/trunk/benchmark/README.md#L59
 
 # You can specify the benchmark by an exact filename instead of using the default argument:
 # ARGS = $$(find $(srcdir)/benchmark -maxdepth 1 -name '*$(ITEM)*.yml' -o -name '*$(ITEM)*.rb')
-make benchmark ARGS=../benchmark/erb_render.rb
+make benchmark ARGS=../benchmark/erb_render.yml
 
 # You can specify any option via $OPTS
 make benchmark OPTS="--help"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]