diff 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
line wrap: on
line diff
--- a/nworker_c.rhope	Wed Oct 06 23:48:32 2010 +0000
+++ b/nworker_c.rhope	Wed Oct 13 01:15:04 2010 +0000
@@ -32,7 +32,18 @@
 {
 	If[[Blueprint Of[cond]] = [Condition Set()]]
 	{
-		out <- [set]Subsets <<[ [[set]Subsets>>]Set[[cond]To String, cond] ]
+		If[[[set]Condition Type >>]=[[cond]Condition Type >>]]
+		{
+			out <- [[set]Variables <<[ Combine[[set]Variables >>, [cond]Variables >>] ]
+				]Subsets <<[ Combine[[set]Subsets >>, [cond]Subsets >>] ]
+		}{
+			[cond]Empty?
+			{
+				out <- [set]Subsets <<[ [[set]Subsets>>]Set[[cond]To String, cond] ]
+			}{
+				out <- set
+			}
+		}
 	}{
 		out <- [set]Variables <<[ [[set]Variables >>]Set[cond, Yes] ]
 	}
@@ -72,47 +83,17 @@
 
 Empty?@Condition Set[set:not empty,empty]
 {
-	Print["Empty?@Condition Set"]
 	[[set]Variables >>]First
 	{
 		not empty <- Yes
 	}{
-		,empty <- [[set]Subsets >>]First Non-empty Set
+		,empty <- [[set]Subsets >>]First
 		{
 			not empty <- Yes
 		}
 	}
 }
 
-_First Non-empty Set[setlist,index:out,none]
-{
-	current <- [setlist]Index[index]
-	[[current]Variables >>]First
-	{
-		out <- index
-	}{
-		,trynext <- [[current]Subsets >>]First Non-empty Set
-		{
-			out <- index
-		}
-	}
-	Val[trynext]
-	{
-		,none <- [setlist]Next[index]
-		{
-			out,none <- _First Non-empty Set[setlist, ~]
-		}
-	}
-}
-
-First Non-empty Set[setlist:index,none]
-{
-	,none <- [setlist]First
-	{
-		index,none <- _First Non-empty Set[setlist,~]
-	}
-}
-
 For Backend@Condition Set[set:out,none]
 {
 	firstvar <- [[set]Variables >>]First
@@ -125,7 +106,7 @@
 		}
 		out <- Fold[_For Backend Subset[?, ?, [set]Condition Type >>], vars, [set]Subsets >>]
 	}{
-		[[set]Subsets >>]First Non-empty Set
+		[[set]Subsets >>]First
 		{
 			firstsub <- [[[set]Subsets >>]Index[~]]For Backend
 			[[set]Subsets >>]Next[~]
@@ -714,7 +695,7 @@
 		If[[[node]Type >>] = ["input"]]
 		{
 			input name <- [[worker]Inputs >>]Index[ [node]Data >> ]
-			[conditions]For Backend
+			[conditions]Empty?
 			{
 				out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]]
 			}{
@@ -723,7 +704,7 @@
 		}{
 			If[[[node]Type >>] = ["const"]]
 			{
-				[conditions]For Backend
+				[conditions]Empty?
 				{
 					out <- AddRef[Result Var Name[[noderef]IO Num >>, [noderef]Index >>]]
 				}{
@@ -1031,7 +1012,7 @@
 {
 	[("const","input")]Find[=[[node]Type >>, ?]]
 	{
-		[[node]Conditions >>]For Backend
+		[[node]Conditions >>]Empty?
 		{
 			out <- Result Var[vars, 0, index]
 		}{