receptacle 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # run with --profile.api in JRUBY_OPTS
5
- require "bundler/inline"
6
- require "jruby/profiler"
7
- PROFILE_NAME = "receptacle"
8
-
9
- gemfile false do
10
- source "https://rubygems.org"
11
- gem "receptacle", path: "./.."
12
- end
13
- require_relative "speed_receptacle"
14
-
15
- Speed.strategy(Speed::Strategy::One)
16
- Speed.wrappers [Speed::Wrappers::W1,
17
- Speed::Wrappers::W2,
18
- Speed::Wrappers::W3,
19
- Speed::Wrappers::W4,
20
- Speed::Wrappers::W5,
21
- Speed::Wrappers::W6]
22
- Speed.a(1)
23
- Speed.b(1)
24
- Speed.c(1)
25
- Speed.d(1)
26
- Speed.e(1)
27
- Speed.f(1)
28
- Speed.g(1)
29
-
30
- GC.disable
31
- profile_data = JRuby::Profiler.profile do
32
- 100_000.times { Speed.a(1) }
33
- end
34
-
35
- profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data)
36
- profile_printer.printProfile(File.open("#{PROFILE_NAME}.graph.profile", "w+"))
37
- profile_printer.printProfile(STDOUT)
38
-
39
- profile_printer = JRuby::Profiler::FlatProfilePrinter.new(profile_data)
40
- profile_printer.printProfile(File.open("#{PROFILE_NAME}.flat.profile", "w+"))
@@ -1,105 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "receptacle"
4
- module Speed
5
- include Receptacle::Repo
6
- mediate :a
7
- mediate :b
8
- mediate :c
9
- mediate :d
10
- mediate :e
11
- mediate :f
12
- mediate :g
13
- module Strategy
14
- class One
15
- def a(arg)
16
- arg
17
- end
18
- alias b a
19
- alias c a
20
- alias d a
21
- alias e a
22
- alias f a
23
- alias g a
24
- end
25
- end
26
-
27
- module Wrappers
28
- class W1
29
- def before_a(args)
30
- args
31
- end
32
-
33
- def after_a(return_values, _args)
34
- return_values
35
- end
36
-
37
- def before_f(args)
38
- args
39
- end
40
-
41
- def after_f(return_values, _args)
42
- return_values
43
- end
44
- end
45
-
46
- class W2
47
- # :a
48
- def before_a(args)
49
- args
50
- end
51
-
52
- def after_a(return_values, _args)
53
- return_values
54
- end
55
-
56
- # :b
57
- def before_b(args)
58
- args
59
- end
60
-
61
- def after_b(return_values, _args)
62
- return_values
63
- end
64
- end
65
- class W3
66
- def before_a(args)
67
- args
68
- end
69
-
70
- def before_c(args)
71
- args
72
- end
73
- end
74
-
75
- class W4
76
- def after_a(return_values, _args)
77
- return_values
78
- end
79
-
80
- def after_d(return_value, _args)
81
- return_value
82
- end
83
- end
84
-
85
- class W5
86
- def before_b(args)
87
- args
88
- end
89
-
90
- def after_c(return_value, _args)
91
- return_value
92
- end
93
- end
94
-
95
- class W6
96
- def after_b(return_value, _args)
97
- return_value
98
- end
99
-
100
- def before_e(args)
101
- args
102
- end
103
- end
104
- end
105
- end