summaryrefslogtreecommitdiff
path: root/benchmark/erb_render.yml
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/erb_render.yml')
-rw-r--r--benchmark/erb_render.yml28
1 files changed, 28 insertions, 0 deletions
diff --git a/benchmark/erb_render.yml b/benchmark/erb_render.yml
new file mode 100644
index 0000000..33f23b2
--- /dev/null
+++ b/benchmark/erb_render.yml
@@ -0,0 +1,28 @@
+benchmark:
+ erb_render: |
+ 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
+loop_count: 1