summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/astarray.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-06 03:13:15 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-06 03:13:15 +0000
commit675495cb21c716f325b23b50ac526929bf592f0f (patch)
tree0ab9e922d46327b832583d158f01b376790f735a /lib/puppet/parser/ast/astarray.rb
parentab0141a2e03542902fc0d83d76b55d5e4b8811d0 (diff)
downloadpuppet-675495cb21c716f325b23b50ac526929bf592f0f.tar.gz
puppet-675495cb21c716f325b23b50ac526929bf592f0f.tar.xz
puppet-675495cb21c716f325b23b50ac526929bf592f0f.zip
Many, many, many performance improvements in the compiler (I hope). I did not change functionality anywhere, but I did some profiling and significantly reduced the runtime of many methods, and especially focused on some key methods that run many times.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1739 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/ast/astarray.rb')
-rw-r--r--lib/puppet/parser/ast/astarray.rb34
1 files changed, 13 insertions, 21 deletions
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb
index fb0a3f671..a0bd5bf89 100644
--- a/lib/puppet/parser/ast/astarray.rb
+++ b/lib/puppet/parser/ast/astarray.rb
@@ -25,10 +25,6 @@ class Puppet::Parser::AST
# This is such a stupid hack. I've no real idea how to make a
# "real" declarative language, so I hack it so it looks like
# one, yay.
- setlist = [
- AST::VarDef, AST::ResourceDefaults, AST::Function
- ]
-
settors = []
others = []
@@ -40,34 +36,30 @@ class Puppet::Parser::AST
@children.each { |child|
if child.instance_of?(AST::ASTArray)
child.each do |ac|
- items << ac
+ if ac.class.settor?
+ settors << ac
+ else
+ others << ac
+ end
end
else
- items << child
- end
- }
-
- # Now sort them all according to the type of action
- items.each { |child|
- if setlist.include?(child.class)
- settors << child
- else
- others << child
+ if child.class.settor?
+ settors << child
+ else
+ others << child
+ end
end
}
rets = [settors, others].flatten.collect { |child|
child.safeevaluate(:scope => scope)
}
+ return rets.reject { |o| o.nil? }
else
# If we're not declarative, just do everything in order.
- rets = @children.collect { |item|
+ return @children.collect { |item|
item.safeevaluate(:scope => scope)
- }
+ }.reject { |o| o.nil? }
end
-
- rets = rets.reject { |obj| obj.nil? }
-
- return rets
end
def push(*ary)