Sha256: 9e642c4319e8e21cbeda816890c06c2b02d565b6a51e19304c88e12b5ea2f144
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require_relative "spec_helper" unless ENV['SKIP_PERFORMANCE'] # run benchmarks in performance/, each output is a hash dumped with Marshal # # { subject: used_time } # describe 'performance' do def bm name bm = __dir__ + '/performance/' + name + '.rb' assert File.exist?(bm), "file not found: #{bm}" ENV['NYARA_FORKED'] = 'spec' res = IO.popen ['ruby', bm] do |io| data = io.read Marshal.load data end assert_nil $!, "an error stops script #{bm}" res end it "[parse_accept_value] faster than sinatra" do res = bm 'parse_accept_value' assert res[:nyara] * 10 < res[:sinatra], res.inspect end it "[parse_param] faster than parse in pure ruby" do res = bm 'parse_param' assert res[:nyara] * 5 < res[:ruby], res.inspect end it "[layout_render] nearly as fast as using tilt..." do res = bm 'layout_render' assert res[:nyara] * 0.9 < res[:tilt], res.inspect end it "[escape] faster than CGI.escape" do res = bm 'escape' assert res[:nyara] * 8 < res[:cgi], res.inspect end end end # unless
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nyara-0.1.pre.2 | spec/performance_spec.rb |
nyara-0.1.pre.1 | spec/performance_spec.rb |