Sha256: 1ead23aac345c2bbbd4a3b9ab84ca1e9a7fffbc6b998b2feb713dfded12a5bad
Contents?: true
Size: 1.06 KB
Versions: 1
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] * 7 < 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nyara-0.1.pre.0 | spec/performance_spec.rb |