Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 32 lines (29 sloc) 0.556 kb
4792779 split the algo tests into a misc directory + added sudoku test
Laurent Sansonetti authored
1 if ARGV.size < 2 or ARGV.size > 3
2 $stderr.puts "Usage: #{__FILE__} <n-iterations> <file.rb> [suite]"
3 exit 1
4 end
5 N = ARGV[0].to_i
6 file = ARGV[1]
7 @suite = ARGV[2]
6c1eac7 initial perf suite
Laurent Sansonetti authored
8 @perf_tests = []
9 def perf_test(name, &b)
4792779 split the algo tests into a misc directory + added sudoku test
Laurent Sansonetti authored
10 if @suite == nil or @suite == name
11 @perf_tests << [name, b]
12 end
6c1eac7 initial perf suite
Laurent Sansonetti authored
13 end
14
4792779 split the algo tests into a misc directory + added sudoku test
Laurent Sansonetti authored
15 load(file)
6c1eac7 initial perf suite
Laurent Sansonetti authored
16
17 @perf_tests.each do |name, proc|
18 times = []
19 N.times do
20 ts = Time.now
21 begin
22 proc.call
23 res = Time.now - ts
24 times << ("%1.6f" % res)
25 rescue
26 times = ['ERROR']
27 break
28 end
29 end
30 puts "#{name}:#{times.join(",")}"
31 end
Something went wrong with that request. Please try again.