<commit_before>require_relative '../../benchmark_helper'

xml = read_big_xml

Benchmark.ips do |bench|
  bench.report '10MB as a String' do
    Oga::XML::PullParser.new(xml).parse { }
  end

  bench.report '10MB as an IO' do
    Oga::XML::PullParser.new(big_xml_file).parse { }
  end
end<commit_msg>Compare results of the XML pull parser benchmark.<commit_after>require_relative '../../benchmark_helper'

xml = read_big_xml

Benchmark.ips do |bench|
  bench.report '10MB as a String' do
    Oga::XML::PullParser.new(xml).parse { }
  end

  bench.report '10MB as an IO' do
    Oga::XML::PullParser.new(big_xml_file).parse { }
  end

  bench.compare!
end
{'fraction_non_alphanumeric': 0.1303680981595092, 'fraction_numerical': 0.012269938650306749, 'mean_word_length': 3.873134328358209, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4546464', 'n_tokens_mistral': 244, 'n_tokens_neox': 233, 'n_words': 55}