Sha256: 455fcd11783612d467286a218784aec2a3e6b7477330e84600423963cc44a380
Contents?: true
Size: 845 Bytes
Versions: 19
Compression:
Stored size: 845 Bytes
Contents
require 'benchmark/driver' require 'erb' require 'erubi' require 'erubis' data = DATA.read mod = Module.new mod.instance_eval("def self.erb(title, content); #{ERB.new(data).src}; end", "(ERB)") mod.instance_eval("def self.erubis(title, content); #{Erubi::Engine.new(data).src}; end", "(Erubi)") mod.instance_eval("def self.erubi(title, content); #{Erubis::Eruby.new(data).src}; end", "(Erubis)") title = "hello world!" content = "hello world!\n" * 10 Benchmark.driver do |x| x.report("ERB #{RUBY_VERSION}") { mod.erb(title, content) } x.report("Erubis #{Erubis::VERSION}") { mod.erubis(title, content) } x.report("Erubi #{Erubi::VERSION}") { mod.erubi(title, content) } x.compare! end __END__ <html> <head> <%= title %> </head> <body> <h1> <%= title %> </h1> <p> <%= content %> </p> </body> </html>
Version data entries
19 entries across 19 versions & 1 rubygems