diff --git a/.gitignore b/.gitignore index c83d889..700982e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ lib/oga/css/parser.rb lib/liboga.* benchmark/fixtures/big.xml +benchmark/fixtures/kaf.xml profile/samples/xml/*.txt profile/samples/xml/*/*.txt diff --git a/benchmark/benchmark_helper.rb b/benchmark/benchmark_helper.rb index fc1c117..2570374 100644 --- a/benchmark/benchmark_helper.rb +++ b/benchmark/benchmark_helper.rb @@ -5,29 +5,27 @@ require 'benchmark/ips' require_relative '../lib/oga' -## -# Returns a File instance pointing to the sample XML file. -# # @return [File] -# def big_xml_file - return File.open(File.expand_path('../fixtures/big.xml', __FILE__), 'r') + File.open(File.expand_path('../fixtures/big.xml', __FILE__), 'r') +end + +# @return [File] +def big_kaf_file + File.open(File.expand_path('../fixtures/kaf.xml', __FILE__), 'r') end -## -# Reads a big XML file and returns it as a String. -# # @return [String] -# def read_big_xml - return big_xml_file.read + big_xml_file.read +end + +# @return [String] +def read_big_kaf + big_kaf_file.read end -## -# Reads a normal sized HTML fixture. -# # @return [String] -# def read_html return File.read(File.expand_path('../fixtures/with_entities.html', __FILE__)) end diff --git a/benchmark/fixtures/kaf.xml.gz b/benchmark/fixtures/kaf.xml.gz new file mode 100644 index 0000000..be3ff25 Binary files /dev/null and b/benchmark/fixtures/kaf.xml.gz differ diff --git a/task/fixtures.rake b/task/fixtures.rake index 9fb368e..8bbba67 100644 --- a/task/fixtures.rake +++ b/task/fixtures.rake @@ -3,4 +3,4 @@ rule '.xml' => '.xml.gz' do |task| end desc 'Generates large XML fixtures' -task :fixtures => ['benchmark/fixtures/big.xml'] +task :fixtures => ['benchmark/fixtures/big.xml', 'benchmark/fixtures/kaf.xml']