Configurable samples in the concurrent xpath bench

This commit is contained in:
Yorick Peterse 2015-08-19 13:34:41 +02:00
parent 399403c290
commit 46f3ec9df5
1 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ stop = false
threads = [] threads = []
thread_count = ENV['THREADS'] ? ENV['THREADS'].to_i : 5 thread_count = ENV['THREADS'] ? ENV['THREADS'].to_i : 5
sample_size = ENV['SAMPLES'] ? ENV['SAMPLES'].to_i : 10
trap 'INT' do trap 'INT' do
stop = true stop = true
@ -29,7 +30,7 @@ thread_count.times.each do
oga_doc = documents.pop oga_doc = documents.pop
evaluator = Oga::XPath::Evaluator.new(oga_doc) evaluator = Oga::XPath::Evaluator.new(oga_doc)
10.times do sample_size.times do
break if stop break if stop
output << Benchmark.measure { evaluator.evaluate_ast(xpath_ast) } output << Benchmark.measure { evaluator.evaluate_ast(xpath_ast) }