Created
December 4, 2008 09:50
-
-
Save ernesto-jimenez/31902 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
=== hpricot-test.rb (1) | |
user system total real | |
bp.xml 0.070000 0.000000 0.070000 ( 0.070721) | |
posts.xml 0.000000 0.000000 0.000000 ( 0.001641) | |
timeline.xml 0.040000 0.000000 0.040000 ( 0.038301) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18686 60.4 0,3 610836 11620 s004 S+ 11:23AM 0:00.29 ruby hpricot-test.rb 1 | |
=== libxml-test.rb (1) | |
user system total real | |
bp.xml 0.010000 0.000000 0.010000 ( 0.005745) | |
posts.xml 0.000000 0.000000 0.000000 ( 0.000270) | |
timeline.xml 0.000000 0.000000 0.000000 ( 0.003124) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18688 42.7 0,2 83096 8348 s004 S+ 11:23AM 0:00.16 ruby libxml-test.rb 1 | |
=== nokogiri-test.rb (1) | |
user system total real | |
bp.xml 0.000000 0.000000 0.000000 ( 0.005222) | |
posts.xml 0.000000 0.000000 0.000000 ( 0.000272) | |
timeline.xml 0.000000 0.000000 0.000000 ( 0.003005) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18690 24.5 0,2 84712 9756 s004 S+ 11:23AM 0:00.17 ruby nokogiri-test.rb 1 | |
=== rexml-test.rb (1) | |
user system total real | |
bp.xml 0.380000 0.010000 0.390000 ( 0.403330) | |
posts.xml 0.010000 0.000000 0.010000 ( 0.009030) | |
timeline.xml 0.120000 0.000000 0.120000 ( 0.126497) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18692 81.7 0,3 609708 10672 s004 S+ 11:23AM 0:00.55 ruby rexml-test.rb 1 | |
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
=== hpricot-test.rb (10) | |
user system total real | |
bp.xml 0.860000 0.010000 0.870000 ( 0.910758) | |
posts.xml 0.050000 0.010000 0.060000 ( 0.043213) | |
timeline.xml 0.210000 0.000000 0.210000 ( 0.222511) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18697 94.7 0,3 610856 12432 s004 S+ 11:23AM 0:01.32 ruby hpricot-test.rb 10 | |
=== libxml-test.rb (10) | |
user system total real | |
bp.xml 0.050000 0.000000 0.050000 ( 0.056485) | |
posts.xml 0.000000 0.000000 0.000000 ( 0.002565) | |
timeline.xml 0.030000 0.000000 0.030000 ( 0.031602) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18699 52.1 0,4 92928 16744 s004 S+ 11:23AM 0:00.24 ruby libxml-test.rb 10 | |
=== nokogiri-test.rb (10) | |
user system total real | |
bp.xml 0.050000 0.010000 0.060000 ( 0.052438) | |
posts.xml 0.000000 0.000000 0.000000 ( 0.002878) | |
timeline.xml 0.030000 0.000000 0.030000 ( 0.030858) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18701 39.7 0,4 91000 15836 s004 R+ 11:23AM 0:00.25 ruby nokogiri-test.rb 10 | |
=== rexml-test.rb (10) | |
user system total real | |
bp.xml 4.170000 0.040000 4.210000 ( 4.311101) | |
posts.xml 0.110000 0.000000 0.110000 ( 0.122040) | |
timeline.xml 1.170000 0.010000 1.180000 ( 1.208105) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18703 97.6 0,3 610580 10916 s004 S+ 11:23AM 0:05.54 ruby rexml-test.rb 10 | |
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
=== hpricot-test.rb (100) | |
user system total real | |
bp.xml 8.940000 0.100000 9.040000 ( 9.263304) | |
posts.xml 0.220000 0.000000 0.220000 ( 0.284251) | |
timeline.xml 2.200000 0.030000 2.230000 ( 2.309936) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18708 95.1 0,3 611880 13400 s004 S+ 11:23AM 0:11.67 ruby hpricot-test.rb 100 | |
=== libxml-test.rb (100) | |
user system total real | |
bp.xml 0.570000 0.040000 0.610000 ( 0.628082) | |
posts.xml 0.020000 0.010000 0.030000 ( 0.026237) | |
timeline.xml 0.300000 0.010000 0.310000 ( 0.316473) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18710 96.0 1,6 146676 68660 s004 S+ 11:23AM 0:01.10 ruby libxml-test.rb 100 | |
=== nokogiri-test.rb (100) | |
user system total real | |
bp.xml 0.470000 0.070000 0.540000 ( 0.620356) | |
posts.xml 0.020000 0.000000 0.020000 ( 0.027653) | |
timeline.xml 0.300000 0.010000 0.310000 ( 0.311232) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18712 92.8 1,9 148784 79768 s004 S+ 11:23AM 0:01.03 ruby nokogiri-test.rb 100 | |
=== rexml-test.rb (100) | |
user system total real | |
bp.xml 42.190000 0.390000 42.580000 ( 44.901954) | |
posts.xml 1.050000 0.010000 1.060000 ( 1.089870) | |
timeline.xml 11.910000 0.080000 11.990000 ( 12.358777) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18714 97.7 0,3 610580 11256 s004 S+ 11:23AM 0:55.66 ruby rexml-test.rb 100 | |
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
=== hpricot-test.rb (1000) | |
user system total real | |
bp.xml 89.750000 1.010000 90.760000 ( 94.127874) | |
posts.xml 2.000000 0.030000 2.030000 ( 2.078060) | |
timeline.xml 21.940000 0.210000 22.150000 ( 22.739463) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18736 96.9 0,3 611900 13180 s004 S+ 11:24AM 1:55.12 ruby hpricot-test.rb 1000 | |
=== libxml-test.rb (1000) | |
user system total real | |
bp.xml 4.990000 0.710000 5.700000 ( 5.851942) | |
posts.xml 2.000000 0.100000 2.100000 ( 2.150298) | |
timeline.xml 2.950000 0.040000 2.990000 ( 3.052139) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18847 97.8 15,5 738100 650096 s004 S+ 11:26AM 0:10.95 ruby libxml-test.rb 1000 | |
=== nokogiri-test.rb (1000) | |
user system total real | |
bp.xml 5.320000 0.500000 5.820000 ( 5.955737) | |
posts.xml 0.220000 0.010000 0.230000 ( 0.229430) | |
timeline.xml 3.410000 0.050000 3.460000 ( 3.642848) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18849 98.2 9,3 458404 390024 s004 S+ 11:26AM 0:09.68 ruby nokogiri-test.rb 1000 | |
=== rexml-test.rb (1000) | |
user system total real | |
bp.xml 406.790000 3.040000 409.830000 (422.428615) | |
posts.xml 10.340000 0.100000 10.440000 ( 11.071618) | |
timeline.xml 118.370000 0.830000 119.200000 (123.048522) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18851 100.0 0,5 618776 19196 s004 S+ 11:26AM 8:59.50 ruby rexml-test.rb 1000 | |
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
=== hpricot-test.rb (10000) | |
user system total real | |
bp.xml 899.360000 9.390000 908.750000 (945.996557) | |
posts.xml 19.850000 0.260000 20.110000 ( 20.464005) | |
timeline.xml 218.640000 1.770000 220.410000 (224.162826) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 18981 96.5 0,3 612904 13772 s004 S+ 11:36AM 19:09.46 ruby hpricot-test.rb 10000 | |
=== libxml-test.rb (10000) | |
user system total real | |
bp.xml 65.500000 3.420000 68.920000 ( 75.904617) | |
posts.xml 3.190000 0.050000 3.240000 ( 3.511718) | |
timeline.xml 32.530000 0.610000 33.140000 ( 34.210402) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 19006 97.4 19,7 939280 825220 s004 S+ 11:55AM 1:45.46 ruby libxml-test.rb 10000 | |
=== nokogiri-test.rb (10000) | |
user system total real | |
bp.xml 55.010000 2.490000 57.500000 ( 59.695396) | |
posts.xml 3.680000 0.030000 3.710000 ( 3.870734) | |
timeline.xml 30.790000 0.450000 31.240000 ( 32.203980) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 19008 97.5 10,0 492196 418428 s004 S+ 11:57AM 1:32.62 ruby nokogiri-test.rb 10000 | |
=== rexml-test.rb (10000) | |
user system total real | |
bp.xml 3954.510000 29.720000 3984.230000 (4127.084596) | |
posts.xml 102.800000 0.700000 103.500000 (106.286669) | |
timeline.xml 1182.890000 8.230000 1191.120000 (1240.096551) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 19010 96.3 0,5 618776 19900 s004 S+ 11:59AM 87:58.89 ruby rexml-test.rb 10000 | |
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
=== hpricot-test.rb (100000) | |
user system total real | |
bp.xml TIMEOUT: took more than 9000 seconds | |
posts.xml 198.570000 2.700000 201.270000 (207.432592) | |
timeline.xml 2206.260000 20.040000 2226.300000 (2334.944655) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 19437 88.0 0,3 612948 13816 s004 R+ 1:30PM 185:56.91 ruby hpricot-test.rb 100000 | |
=== libxml-test.rb (100000) | |
user system total real | |
bp.xml 656.450000 25.510000 681.960000 (705.105408) | |
posts.xml 32.860000 0.250000 33.110000 ( 33.760130) | |
timeline.xml 336.510000 5.950000 342.460000 (349.642270) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 21312 99.1 22,6 1077744 949652 s004 S+ 4:43PM 17:37.69 ruby libxml-test.rb 100000 | |
=== nokogiri-test.rb (100000) | |
user system total real | |
bp.xml 555.260000 21.740000 577.000000 (609.976187) | |
posts.xml 30.720000 0.200000 30.920000 ( 34.491528) | |
timeline.xml 310.330000 4.380000 314.710000 (332.091211) | |
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND | |
hydrus 21454 98.8 10,0 493220 418976 s004 S+ 5:01PM 15:22.81 ruby nokogiri-test.rb 100000 | |
=== rexml-test.rb (100000) | |
user system total real | |
bp.xml TIMEOUT: took more than 9000 seconds | |
posts.xml 1049.110000 7.680000 1056.790000 (1092.721907) | |
timeline.xml TIMEOUT: took more than 9000 seconds |
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
%w[benchmark pp timeout].each { |x| require x } | |
TIMES = (ARGV[0] || 10).to_i | |
TIMEOUT = 9000 | |
def measure | |
puts "=== #{$0} (#{TIMES})" | |
Benchmark.bm(15) do |x| | |
{ | |
'posts.xml' => '//posts//post', | |
'timeline.xml' => '//status//name', | |
'bp.xml' => '//p//a' | |
}.each do |file, xpath| | |
xml = File.read(file) | |
begin | |
Timeout::timeout(TIMEOUT) { | |
x.report(file.ljust(15)) { | |
TIMES.times { | |
yield(xml, xpath) | |
} | |
}.to_s | |
} | |
rescue Timeout::Error | |
puts "TIMEOUT: took more than #{TIMEOUT} seconds" | |
end | |
end | |
puts "" | |
puts `ps aux`.grep(/#{Process.pid}|USER/) | |
puts "" | |
end | |
end |
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
%w[config rubygems hpricot].each { |x| require x } | |
measure do |xml, xpath| | |
doc = Hpricot(xml) | |
doc.search(xpath) do |node| | |
node | |
end | |
end |
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
%w[config rubygems xml/libxml].each { |x| require x } | |
measure do |xml, xpath| | |
parser, parser.string = XML::Parser.new, xml | |
doc = parser.parse | |
doc.find(xpath).each do |node| | |
node | |
end | |
end |
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
%w[config rubygems nokogiri].each { |x| require x } | |
measure do |xml, xpath| | |
doc = Nokogiri::XML(xml) | |
doc.xpath(xpath).each do |node| | |
node | |
end | |
end |
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
%w[config rexml/document].each { |x| require x } | |
measure do |xml, xpath| | |
doc = REXML::Document.new(xml) | |
REXML::XPath.each(doc, xpath) do |node| | |
node | |
end | |
end |
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
for i in 1 10 100 1000 10000 100000 | |
do | |
ARCHIVO="benchmark_$i" | |
echo "" > $ARCHIVO | |
for j in $(ls *.rb) | |
do | |
echo running $j $i | |
ruby $j $i >> $ARCHIVO | |
done | |
done |
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
$ du -h *.xml | |
152K bp.xml | |
8,0K posts.xml | |
20K timeline.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment