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

ruby-changes:51291

From: normal <ko1@a...>
Date: Thu, 24 May 2018 05:58:52 +0900 (JST)
Subject: [ruby-changes:51291] normal:r63497 (trunk): benchmark/bm_*erb*: fix for --measure=size/peak in driver.rb

normal	2018-05-24 05:58:46 +0900 (Thu, 24 May 2018)

  New Revision: 63497

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

  Log:
    benchmark/bm_*erb*: fix for --measure=size/peak in driver.rb
    
    benchmark/memory_wrapper.rb will Kernel#load these
    scripts, preventing DATA from being initialized, so
    use heredoc instead.

  Modified files:
    trunk/benchmark/bm_app_erb.rb
    trunk/benchmark/bm_erb_render.rb
Index: benchmark/bm_erb_render.rb
===================================================================
--- benchmark/bm_erb_render.rb	(revision 63496)
+++ benchmark/bm_erb_render.rb	(revision 63497)
@@ -1,6 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_erb_render.rb#L1
 require 'erb'
 
-data = DATA.read
+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
@@ -12,15 +23,3 @@ mod.instance_eval(src, "(ERB)") https://github.com/ruby/ruby/blob/trunk/benchmark/bm_erb_render.rb#L23
 max.times do
   mod.render(title, content)
 end
-
-__END__
-
-<html>
-  <head> <%= title %> </head>
-  <body>
-    <h1> <%= title %> </h1>
-    <p>
-      <%= content %>
-    </p>
-  </body>
-</html>
Index: benchmark/bm_app_erb.rb
===================================================================
--- benchmark/bm_app_erb.rb	(revision 63496)
+++ benchmark/bm_app_erb.rb	(revision 63497)
@@ -4,17 +4,7 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_app_erb.rb#L4
 
 require 'erb'
 
-data = DATA.read
-max = 15_000
-title = "hello world!"
-content = "hello world!\n" * 10
-
-max.times{
-  ERB.new(data).result(binding)
-}
-
-__END__
-
+data = <<erb
 <html>
   <head> <%= title %> </head>
   <body>
@@ -24,3 +14,12 @@ __END__ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_app_erb.rb#L14
     </p>
   </body>
 </html>
+erb
+
+max = 15_000
+title = "hello world!"
+content = "hello world!\n" * 10
+
+max.times{
+  ERB.new(data).result(binding)
+}

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

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