diff --git a/Gemfile.lock b/Gemfile.lock index 14f51dd..664ee70 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,6 +8,7 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.3) + benchmark-ips (2.15.1) bundler-audit (0.9.3) bundler (>= 1.2.0) thor (~> 1.0) @@ -82,6 +83,7 @@ PLATFORMS x86_64-linux DEPENDENCIES + benchmark-ips bundler-audit colorize html2text! diff --git a/bench/convert.rb b/bench/convert.rb new file mode 100644 index 0000000..d96cc73 --- /dev/null +++ b/bench/convert.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# Usage: bundle exec ruby bench/convert.rb +# +# Compare branches by running it on each. The sibling divs case guards against +# the quadratic slowdown fixed in #45. + +require 'benchmark/ips' +require_relative '../lib/html2text' + +examples = Dir[File.join(__dir__, '../spec/examples/*.html')].map { |f| File.read(f) } +sibling_divs = "