Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 30 lines (25 sloc) 0.357 kB
2380a02 @mikepack Add refinement benchmark
authored
1 require 'benchmark'
2
3 class User; end
4
5 module Runner
6 refine User do
7 def run
8 Math.tan(Math::PI / 4)
9 end
10 end
11 end
12
13 class Context
14 using Runner
15
a3c09ee @mikepack Change context trigger
authored
16 def self.call
2380a02 @mikepack Add refinement benchmark
authored
17 user = User.new
18 user.run
19 end
20 end
21
22 Benchmark.bm do |bench|
23 3.times do
24 bench.report('refine') do
25 1000000.times do
a3c09ee @mikepack Change context trigger
authored
26 Context.call
2380a02 @mikepack Add refinement benchmark
authored
27 end
28 end
29 end
30 end
Something went wrong with that request. Please try again.