Skip to content

Commit

Permalink
Merge branch 'new-views' of git@github.com:yrashk/strokedb into new-v…
Browse files Browse the repository at this point in the history
…iews
  • Loading branch information
yrashk committed Apr 29, 2008
2 parents 4b49abb + 56cfbc7 commit ed6baa6
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions meta/benchmarks/skiplist_volume.rb
Expand Up @@ -8,30 +8,37 @@

@path = File.dirname(__FILE__) + "/../../spec/temp/storages/data_volume"

SimpleSkiplist.optimize!(:C)

[10000].each do |n|

def benchmark!(lang)
[1000].each do |n|
bm(60) do |x|
FileUtils.rm_rf @path
skiplist = SkiplistVolume.new(:path => @path, :max_log_size => 1024*4000)

records = []
n.times {|v| records << ["key#{v}".ljust(128," "),"val#{v}".ljust(128," ")] }

offsets = []
x.report("Inserting #{n} pairs [#{lang}]") do
records.each {|rec| skiplist.insert(rec[0],rec[1]) }
end

x.report("Reading #{n} pairs [#{lang}]") do
records.each {|rec| skiplist.find(rec[0]) }
end

x.report("Dumping #{n/100} items [#{lang}]") do
(n/100).times {|i| skiplist.dump! }
end

skiplist.close!

bm(60) do |x|
FileUtils.rm_rf @path
skiplist = SkiplistVolume.new(:path => @path, :max_log_size => 1024*4000)

records = []
n.times {|v| records << ["key#{v}".ljust(128," "),"val#{v}".ljust(128," ")] }

offsets = []
x.report("Inserting #{n} pairs") do
records.each {|rec| skiplist.insert(rec[0],rec[1]) }
end
end
end

x.report("Reading #{n} pairs") do
records.each {|rec| skiplist.find(rec[0]) }
end
benchmark!("Ruby")


skiplist.close!
SimpleSkiplist.optimize!(:C)

end
benchmark!("C")

end

0 comments on commit ed6baa6

Please sign in to comment.