1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Resurrect erubi in string_template benchmark

This commit is contained in:
Takashi Kokubun 2019-09-16 00:19:18 +09:00
parent ec1c84ac48
commit d1f72cab2e
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
2 changed files with 53 additions and 1 deletions

View file

@ -1,7 +1,7 @@
# Original: https://github.com/amatsuda/string_template/blob/master/benchmark.rb
require 'benchmark_driver'
Benchmark.driver(repeat_count: 8) do |x|
Benchmark.driver(repeat_count: 1) do |x|
x.prelude %{
require 'rails'
require 'action_view'
@ -16,9 +16,11 @@ Benchmark.driver(repeat_count: 8) do |x|
# compile template
hello = 'benchmark/dynamic_merger/hello'
view.render(template: hello, handlers: 'erb')
view.render(template: hello, handlers: 'string')
view.render(template: hello, handlers: 'haml')
}
x.report 'erubi', %{ view.render(template: hello, handlers: 'erb') }
x.report 'string', %{ view.render(template: hello, handlers: 'string') }
x.report 'hamlit', %{ view.render(template: hello, handlers: 'haml') }
x.loop_count 100_000

View file

@ -0,0 +1,50 @@
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>
hello, <%== @world %>