Created
August 18, 2022 02:17
-
-
Save masao/398d9009cd8ba78d9da9283c8038c27d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "benchmark" | |
require "rubygems" | |
if ARGV.size < 1 | |
puts <<-EOF | |
USAGE: | |
#$0 "~> 3.2.0" | |
or | |
#$0 "~> 3.1.0" | |
Install the versions of libraries with gem install before using this benchmark. | |
EOF | |
exit | |
end | |
v = ARGV.first | |
gem "rdf", v | |
gem "rdf-n3", v | |
require "rdf" | |
require "rdf/n3" | |
puts "RDF::VERSION: #{RDF::VERSION}" | |
puts "RDF::N3::VERSION: #{RDF::N3::VERSION}" | |
Benchmark.bm(15) do |r| | |
%w( test10k.n3 test100k.n3 test200k.n3 test1000k.n3 ).each do |file| | |
r.report(file) do | |
g = RDF::Graph.new | |
RDF::N3::Reader.open(file) do |reader| | |
count = 0 | |
reader.each_statement do |statement| | |
g.insert << statement | |
count += 1 | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment