comparison nworker_c.rhope @ 114:25a205094f9b

More performance optimizations
author Mike Pavone <pavone@retrodev.com>
date Wed, 13 Oct 2010 01:15:04 +0000
parents 2f6f0867fd68
children 04148770c229
comparison
equal deleted inserted replaced
110:336da6ce8174 114:25a205094f9b
30 30
31 Add Condition@Condition Set[set,cond:out] 31 Add Condition@Condition Set[set,cond:out]
32 { 32 {
33 If[[Blueprint Of[cond]] = [Condition Set()]] 33 If[[Blueprint Of[cond]] = [Condition Set()]]
34 { 34 {
35 out <- [set]Subsets <<[ [[set]Subsets>>]Set[[cond]To String, cond] ] 35 If[[[set]Condition Type >>]=[[cond]Condition Type >>]]
36 {
37 out <- [[set]Variables <<[ Combine[[set]Variables >>, [cond]Variables >>] ]
38 ]Subsets <<[ Combine[[set]Subsets >>, [cond]Subsets >>] ]
39 }{
40 [cond]Empty?
41 {
42 out <- [set]Subsets <<[ [[set]Subsets>>]Set[[cond]To String, cond] ]
43 }{
44 out <- set
45 }
46 }
36 }{ 47 }{
37 out <- [set]Variables <<[ [[set]Variables >>]Set[cond, Yes] ] 48 out <- [set]Variables <<[ [[set]Variables >>]Set[cond, Yes] ]
38 } 49 }
39 } 50 }
40 51
70 } 81 }
71 } 82 }
72 83
73 Empty?@Condition Set[set:not empty,empty] 84 Empty?@Condition Set[set:not empty,empty]
74 { 85 {
75 Print["Empty?@Condition Set"]
76 [[set]Variables >>]First 86 [[set]Variables >>]First
77 { 87 {
78 not empty <- Yes 88 not empty <- Yes
79 }{ 89 }{
80 ,empty <- [[set]Subsets >>]First Non-empty Set 90 ,empty <- [[set]Subsets >>]First
81 { 91 {
82 not empty <- Yes 92 not empty <- Yes
83 } 93 }
84 } 94 }
85 } 95 }
86 96
87 _First Non-empty Set[setlist,index:out,none]
88 {
89 current <- [setlist]Index[index]
90 [[current]Variables >>]First
91 {
92 out <- index
93 }{
94 ,trynext <- [[current]Subsets >>]First Non-empty Set
95 {
96 out <- index
97 }
98 }
99 Val[trynext]
100 {
101 ,none <- [setlist]Next[index]
102 {
103 out,none <- _First Non-empty Set[setlist, ~]
104 }
105 }
106 }
107
108 First Non-empty Set[setlist:index,none]
109 {
110 ,none <- [setlist]First
111 {
112 index,none <- _First Non-empty Set[setlist,~]
113 }
114 }
115
116 For Backend@Condition Set[set:out,none] 97 For Backend@Condition Set[set:out,none]
117 { 98 {
118 firstvar <- [[set]Variables >>]First 99 firstvar <- [[set]Variables >>]First
119 { 100 {
120 [[set]Variables >>]Next[~] 101 [[set]Variables >>]Next[~]
123 }{ 104 }{
124 vars <- Val[firstvar] 105 vars <- Val[firstvar]
125 } 106 }
126 out <- Fold[_For Backend Subset[?, ?, [set]Condition Type >>], vars, [set]Subsets >>] 107 out <- Fold[_For Backend Subset[?, ?, [set]Condition Type >>], vars, [set]Subsets >>]
127 }{ 108 }{
128 [[set]Subsets >>]First Non-empty Set 109 [[set]Subsets >>]First
129 { 110 {
130 firstsub <- [[[set]Subsets >>]Index[~]]For Backend 111 firstsub <- [[[set]Subsets >>]Index[~]]For Backend
131 [[set]Subsets >>]Next[~] 112 [[set]Subsets >>]Next[~]
132 { 113 {
133 out <- _Fold[[set]Subsets >>, ~, firstsub, _For Backend Subset[?, ?, [set]Condition Type >>]] 114 out <- _Fold[[set]Subsets >>, ~, firstsub, _For Backend Subset[?, ?, [set]Condition Type >>]]
712 conditions <- [node]Conditions >> 693 conditions <- [node]Conditions >>
713 694
714 If[[[node]Type >>] = ["input"]] 695 If[[[node]Type >>] = ["input"]]
715 { 696 {
716 input name <- [[worker]Inputs >>]Index[ [node]Data >> ] 697 input name <- [[worker]Inputs >>]Index[ [node]Data >> ]
717 [conditions]For Backend 698 [conditions]Empty?
718 { 699 {
719 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]] 700 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]]
720 }{ 701 }{
721 out <- AddRef[input name] 702 out <- AddRef[input name]
722 } 703 }
723 }{ 704 }{
724 If[[[node]Type >>] = ["const"]] 705 If[[[node]Type >>] = ["const"]]
725 { 706 {
726 [conditions]For Backend 707 [conditions]Empty?
727 { 708 {
728 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]] 709 out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]]
729 }{ 710 }{
730 out <- Constant[Const Name[[node]Data >>, [noderef]Index >>, [worker]Name >>]] 711 out <- Constant[Const Name[[node]Data >>, [noderef]Index >>, [worker]Name >>]]
731 } 712 }
1029 1010
1030 _No Release[vars,node,index,worker:out] 1011 _No Release[vars,node,index,worker:out]
1031 { 1012 {
1032 [("const","input")]Find[=[[node]Type >>, ?]] 1013 [("const","input")]Find[=[[node]Type >>, ?]]
1033 { 1014 {
1034 [[node]Conditions >>]For Backend 1015 [[node]Conditions >>]Empty?
1035 { 1016 {
1036 out <- Result Var[vars, 0, index] 1017 out <- Result Var[vars, 0, index]
1037 }{ 1018 }{
1038 out <- vars 1019 out <- vars
1039 } 1020 }