Sha256: bcf9de31853e438454bfa93b1246e832fee2489bc5e9ee4d50cf7d3372daae6d

Contents?: true

Size: 574 Bytes

Versions: 15

Compression:

Stored size: 574 Bytes

Contents

require 'benchmark/ips'
require 'trenni/markup'

RSpec.describe Trenni::Markup do
	let(:code_string) {'javascript:if (foo < bar) {alert("Hello World")}'}
	let(:general_string) {"a" * code_string.size}
	
	it "should be fast to parse large documents" do
		Benchmark.ips do |x|
			x.report("General String") do |times|
				while (times -= 1) >= 0
					Trenni::Markup.escape_string(general_string)
				end
			end
			
			x.report("Code String") do |times|
				while (times -= 1) >= 0
					Trenni::Markup.escape_string(code_string)
				end
			end
			
			x.compare!
		end
	end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
trenni-3.7.1 spec/trenni/markup_performance_spec.rb
trenni-3.7.0 spec/trenni/markup_performance_spec.rb
trenni-3.6.1 spec/trenni/markup_performance_spec.rb
trenni-3.6.0 spec/trenni/markup_performance_spec.rb
trenni-3.5.0 spec/trenni/markup_performance_spec.rb
trenni-3.4.0 spec/trenni/markup_performance_spec.rb
trenni-3.3.0 spec/trenni/markup_performance_spec.rb
trenni-3.2.0 spec/trenni/markup_performance_spec.rb
trenni-3.1.3 spec/trenni/markup_performance_spec.rb
trenni-3.1.2 spec/trenni/markup_performance_spec.rb
trenni-3.1.1 spec/trenni/markup_performance_spec.rb
trenni-3.1.0 spec/trenni/markup_performance_spec.rb
trenni-3.0.4 spec/trenni/markup_performance_spec.rb
trenni-3.0.3 spec/trenni/markup_performance_spec.rb
trenni-3.0.0 spec/trenni/markup_performance_spec.rb