redshift 1.3.20 → 1.3.21

Sign up to get free protection for your applications and to get access to all the features.
data/RELEASE-NOTES CHANGED
@@ -1,3 +1,9 @@
1
+ redshift 1.3.21
2
+
3
+ - share flow wrapper classes when equation is same
4
+
5
+ - renamed bench/queue.rb to avoid conflict
6
+
1
7
  redshift 1.3.20
2
8
 
3
9
  - added hook_remove_comp
@@ -0,0 +1,66 @@
1
+ alg-state:
2
+ - 0 comps X 1000 steps X 0 non-alg: 0.00
3
+ - 10 comps X 1000 steps X 0 non-alg: 0.00
4
+ - 100 comps X 1000 steps X 0 non-alg: 0.01
5
+ - 1000 comps X 1000 steps X 0 non-alg: 0.07
6
+ - 10000 comps X 1000 steps X 0 non-alg: 3.46
7
+ continuous:
8
+ - 1 comps X 1000000 steps: 2.53
9
+ - 10 comps X 100000 steps: 0.46
10
+ - 100 comps X 10000 steps: 0.32
11
+ - 1000 comps X 1000 steps: 0.32
12
+ - 10000 comps X 100 steps: 1.03
13
+ - 100000 comps X 10 steps: 1.30
14
+ discrete:
15
+ - 1 comps X 1000000 steps X 0 watchers: 3.01
16
+ - 10 comps X 100000 steps X 0 watchers: 0.48
17
+ - 100 comps X 10000 steps X 0 watchers: 0.18
18
+ - 1000 comps X 1000 steps X 0 watchers: 0.20
19
+ - 10000 comps X 100 steps X 0 watchers: 0.49
20
+ - 100000 comps X 10 steps X 0 watchers: 0.64
21
+ - 1 comps X 1000000 steps X 1 watchers: 3.91
22
+ - 10 comps X 100000 steps X 1 watchers: 0.73
23
+ - 100 comps X 10000 steps X 1 watchers: 0.49
24
+ - 1000 comps X 1000 steps X 1 watchers: 0.60
25
+ - 10000 comps X 100 steps X 1 watchers: 2.08
26
+ - 100000 comps X 10 steps X 1 watchers: 2.65
27
+ - 1 comps X 200000 steps X 5 watchers: 0.85
28
+ - 10 comps X 20000 steps X 5 watchers: 0.41
29
+ - 100 comps X 2000 steps X 5 watchers: 0.49
30
+ - 1000 comps X 200 steps X 5 watchers: 0.90
31
+ - 10000 comps X 20 steps X 5 watchers: 1.94
32
+ - 100000 comps X 2 steps X 5 watchers: 3.45
33
+ euler:
34
+ - 1 comps X 1000000 steps: 2.28
35
+ - 10 comps X 100000 steps: 0.34
36
+ - 100 comps X 10000 steps: 0.21
37
+ - 1000 comps X 1000 steps: 0.24
38
+ - 10000 comps X 100 steps: 0.86
39
+ - 100000 comps X 10 steps: 1.07
40
+ formula:
41
+ - 1 comps X 100000 steps: 0.35
42
+ - 10 comps X 10000 steps: 0.13
43
+ - 100 comps X 1000 steps: 0.12
44
+ - 1000 comps X 100 steps: 0.12
45
+ - 10000 comps X 10 steps: 0.19
46
+ half-strict:
47
+ - 10 comps X 100000 steps: 3.90
48
+ - 100 comps X 10000 steps: 1.26
49
+ - 1000 comps X 1000 steps: 1.03
50
+ - 10000 comps X 100 steps: 1.71
51
+ - 100000 comps X 10 steps: 3.02
52
+ inertness:
53
+ - 0 comps X 10000 steps X 0 non-inert: 0.02
54
+ - 1000 comps X 10000 steps X 0 non-inert: 0.38
55
+ - 0 comps X 10000 steps X 1 non-inert: 0.16
56
+ - 1000 comps X 10000 steps X 1 non-inert: 0.56
57
+ queues:
58
+ - 1 senders X 100000 steps X 1 receivers: 0.26
59
+ - 10 senders X 10000 steps X 1 receivers: 0.05
60
+ - 100 senders X 1000 steps X 1 receivers: 0.04
61
+ - 1 senders X 10000 steps X 10 receivers: 0.05
62
+ - 10 senders X 1000 steps X 10 receivers: 0.00
63
+ - 100 senders X 100 steps X 10 receivers: 0.01
64
+ - 1 senders X 1000 steps X 100 receivers: 0.02
65
+ - 10 senders X 100 steps X 100 receivers: 0.02
66
+ - 100 senders X 10 steps X 100 receivers: 0.02
@@ -0,0 +1,66 @@
1
+ alg-state:
2
+ - 0 comps X 1000 steps X 0 non-alg: 0.00
3
+ - 10 comps X 1000 steps X 0 non-alg: 0.01
4
+ - 100 comps X 1000 steps X 0 non-alg: 0.01
5
+ - 1000 comps X 1000 steps X 0 non-alg: 0.08
6
+ - 10000 comps X 1000 steps X 0 non-alg: 3.59
7
+ continuous:
8
+ - 1 comps X 1000000 steps: 2.56
9
+ - 10 comps X 100000 steps: 0.47
10
+ - 100 comps X 10000 steps: 0.30
11
+ - 1000 comps X 1000 steps: 0.32
12
+ - 10000 comps X 100 steps: 1.01
13
+ - 100000 comps X 10 steps: 1.30
14
+ discrete:
15
+ - 1 comps X 1000000 steps X 0 watchers: 2.90
16
+ - 10 comps X 100000 steps X 0 watchers: 0.49
17
+ - 100 comps X 10000 steps X 0 watchers: 0.18
18
+ - 1000 comps X 1000 steps X 0 watchers: 0.21
19
+ - 10000 comps X 100 steps X 0 watchers: 0.49
20
+ - 100000 comps X 10 steps X 0 watchers: 0.66
21
+ - 1 comps X 1000000 steps X 1 watchers: 3.78
22
+ - 10 comps X 100000 steps X 1 watchers: 0.72
23
+ - 100 comps X 10000 steps X 1 watchers: 0.51
24
+ - 1000 comps X 1000 steps X 1 watchers: 0.59
25
+ - 10000 comps X 100 steps X 1 watchers: 2.10
26
+ - 100000 comps X 10 steps X 1 watchers: 2.67
27
+ - 1 comps X 200000 steps X 5 watchers: 0.85
28
+ - 10 comps X 20000 steps X 5 watchers: 0.42
29
+ - 100 comps X 2000 steps X 5 watchers: 0.60
30
+ - 1000 comps X 200 steps X 5 watchers: 0.88
31
+ - 10000 comps X 20 steps X 5 watchers: 1.94
32
+ - 100000 comps X 2 steps X 5 watchers: 3.43
33
+ euler:
34
+ - 1 comps X 1000000 steps: 2.29
35
+ - 10 comps X 100000 steps: 0.35
36
+ - 100 comps X 10000 steps: 0.22
37
+ - 1000 comps X 1000 steps: 0.24
38
+ - 10000 comps X 100 steps: 0.85
39
+ - 100000 comps X 10 steps: 1.08
40
+ formula:
41
+ - 1 comps X 100000 steps: 0.34
42
+ - 10 comps X 10000 steps: 0.13
43
+ - 100 comps X 1000 steps: 0.12
44
+ - 1000 comps X 100 steps: 0.12
45
+ - 10000 comps X 10 steps: 0.19
46
+ half-strict:
47
+ - 10 comps X 100000 steps: 4.07
48
+ - 100 comps X 10000 steps: 1.30
49
+ - 1000 comps X 1000 steps: 1.04
50
+ - 10000 comps X 100 steps: 1.74
51
+ - 100000 comps X 10 steps: 3.00
52
+ inertness:
53
+ - 0 comps X 10000 steps X 0 non-inert: 0.02
54
+ - 1000 comps X 10000 steps X 0 non-inert: 0.38
55
+ - 0 comps X 10000 steps X 1 non-inert: 0.14
56
+ - 1000 comps X 10000 steps X 1 non-inert: 0.54
57
+ queues:
58
+ - 1 senders X 100000 steps X 1 receivers: 0.28
59
+ - 10 senders X 10000 steps X 1 receivers: 0.05
60
+ - 100 senders X 1000 steps X 1 receivers: 0.03
61
+ - 1 senders X 10000 steps X 10 receivers: 0.06
62
+ - 10 senders X 1000 steps X 10 receivers: 0.02
63
+ - 100 senders X 100 steps X 10 receivers: 0.03
64
+ - 1 senders X 1000 steps X 100 receivers: 0.01
65
+ - 10 senders X 100 steps X 100 receivers: 0.02
66
+ - 100 senders X 10 steps X 100 receivers: 0.04
data/bench/bench CHANGED
@@ -20,7 +20,7 @@ pat = pat ? Regexp.new(pat) : //
20
20
  formula
21
21
  half-strict
22
22
  inertness
23
- queue
23
+ queues
24
24
  }.grep(pat).each do |name|
25
25
  bench_one(name)
26
26
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'redshift'
4
4
 
5
- module Queue
5
+ module Queues
6
6
  class Clock < RedShift::Component
7
7
  # the only continuous var in the whole system
8
8
  strictly_continuous :time
@@ -87,6 +87,6 @@ end
87
87
 
88
88
  if __FILE__ == $0
89
89
  require File.join(File.dirname(__FILE__), 'bench')
90
- puts "queue:"
91
- Queue.do_bench_one(*ARGV.map{|s|s.to_i}) {|l| puts l}
90
+ puts "queues:"
91
+ Queues.do_bench_one(*ARGV.map{|s|s.to_i}) {|l| puts l}
92
92
  end
@@ -33,7 +33,7 @@ end
33
33
  module RedShift
34
34
  include Math
35
35
 
36
- VERSION = '1.3.20'
36
+ VERSION = '1.3.21'
37
37
 
38
38
  Infinity = Math::Infinity
39
39
 
@@ -681,7 +681,7 @@ module RedShift
681
681
  cont_var = define_continuous(:permissive, [var])[0]
682
682
  end
683
683
 
684
- add_flow([state, cont_var] => flow.flow_wrapper(self, state))
684
+ add_flow([state, cont_var] => flow_wrapper(flow, state))
685
685
 
686
686
  after_commit do
687
687
  ## a pity to use after_commit, when "just_before_commit" would be ok
@@ -694,6 +694,12 @@ module RedShift
694
694
  end
695
695
  end
696
696
  end
697
+
698
+ def flow_wrapper flow, state
699
+ @flow_wrapper_hash ||= {}
700
+ @flow_wrapper_hash[ [flow.var, flow.formula] ] ||=
701
+ flow.flow_wrapper(self, state)
702
+ end
697
703
 
698
704
  def define_guard(expr)
699
705
  @guard_wrapper_hash ||= {} ## could be a superhash?
@@ -23,6 +23,9 @@ module RedShift; class AlgebraicFlow
23
23
  exc = declare_class CircularDefinitionError
24
24
  msg = "Circularity in algebraic formula for #{var_name} in state " +
25
25
  "#{state} of class #{cl.name}."
26
+ ## note that state may not be the same as the object's state, due
27
+ ## to flow wrapper caching
28
+
26
29
  setup :shadow => %{
27
30
  shadow = (#{ssn} *)comp_shdw;
28
31
  cont_state = (#{cont_state_ssn} *)shadow->cont_state;
data/test/test_flow.rb CHANGED
@@ -129,6 +129,40 @@ class Flow_AlgDiff < FlowTestComponent
129
129
  end
130
130
  end
131
131
 
132
+ # Test that shared flow implementations are correct.
133
+ class Flow_MultiState < FlowTestComponent
134
+ state :S1, :S2, :S3
135
+
136
+ default do
137
+ self.x = 2
138
+ @consistent = true
139
+ start S1
140
+ end
141
+
142
+ flow S1, S2 do
143
+ diff "x' = x"
144
+ end
145
+
146
+ transition S1 => S2 do
147
+ guard " x > 3 "
148
+ action do
149
+ @save_x = x
150
+ end
151
+ reset :x => 2
152
+ end
153
+
154
+ transition S2 => S3 do
155
+ guard " x > 3 "
156
+ action do
157
+ @consistent = (@save_x == x)
158
+ end
159
+ end
160
+
161
+ def assert_consistent test
162
+ assert(@consistent)
163
+ end
164
+ end
165
+
132
166
  ## TO DO ##
133
167
  =begin
134
168
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redshift
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 49
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 20
10
- version: 1.3.20
9
+ - 21
10
+ version: 1.3.21
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joel VanderWerf
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-27 00:00:00 -07:00
18
+ date: 2010-07-08 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 87
29
+ hash: 85
30
30
  segments:
31
31
  - 0
32
32
  - 16
33
- - 4
34
- version: 0.16.4
33
+ - 5
34
+ version: 0.16.5
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -42,10 +42,11 @@ dependencies:
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- hash: 3
45
+ hash: 117
46
46
  segments:
47
47
  - 0
48
- version: "0"
48
+ - 63
49
+ version: "0.63"
49
50
  type: :runtime
50
51
  version_requirements: *id002
51
52
  - !ruby/object:Gem::Dependency
@@ -82,7 +83,9 @@ files:
82
83
  - README
83
84
  - RELEASE-NOTES
84
85
  - TODO
86
+ - bench/after-flow-cache
85
87
  - bench/alg-state.rb
88
+ - bench/before-flow-cache
86
89
  - bench/bench
87
90
  - bench/bench.rb
88
91
  - bench/continuous.rb
@@ -92,7 +95,7 @@ files:
92
95
  - bench/formula.rb
93
96
  - bench/half-strict.rb
94
97
  - bench/inertness.rb
95
- - bench/queue.rb
98
+ - bench/queues.rb
96
99
  - bench/run
97
100
  - bench/simple.rb
98
101
  - bench/strictness.rb