Sha256: 252c3c02b0bad58620d29762b0b734d4f81de7846311f784610bf347c1d6aedd
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
require 'test_helper' require 'minitest/benchmark' if ENV["BENCH"] def markdown(s) Node.parse_string(s).to_html end # Disabled by default # (these are the easy ones -- the evil ones are not disclosed) if ENV["BENCH"] then class PathologicalInputsTest < Minitest::Benchmark def setup end def bench_pathological_1 assert_performance_linear 0.99 do |n| star = '*' * (n * 10) markdown("#{star}#{star}hi#{star}#{star}") end end def bench_pathological_2 assert_performance_linear 0.99 do |n| c = "`t`t`t`t`t`t" * (n * 10) markdown(c) end end def bench_pathological_3 assert_performance_linear 0.99 do |n| markdown(" [a]: #{ "A" * n }\n\n#{ "[a][]" * n }\n") end end def bench_pathological_4 assert_performance_linear 0.5 do |n| markdown("#{'[' * n}a#{']' * n}") end end def bench_pathological_5 assert_performance_linear 0.99 do |n| markdown("#{'**a *a ' * n}#{'a* a**' * n}") end end def bench_unbound_recursion assert_performance_linear 0.99 do |n| markdown(("[" * n) + "foo" + ("](bar)" * n )) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems