File: bench_document_encoding.rb

package info (click to toggle)
ruby-nokogiri 1.18.10%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 8,124 kB
  • sloc: ansic: 38,893; xml: 27,665; ruby: 27,510; java: 15,398; cpp: 7,107; yacc: 244; sh: 208; makefile: 149; sed: 14
file content (15 lines) | stat: -rw-r--r-- 393 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

require "helper"

class TestBenchDocumentEncoding < Nokogiri::TestBenchmark
  describe "encoding detection" do
    bench_range { bench_exp(1, 40_000, 4) }

    bench_performance_constant("encoding detection", 0.99999) do |n|
      redos_string = "<?xml " + (" " * n)
      redos_string.encode!("ASCII-8BIT")
      Nokogiri::HTML4(redos_string)
    end
  end
end