From 675495cb21c716f325b23b50ac526929bf592f0f Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 6 Oct 2006 03:13:15 +0000 Subject: 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 --- lib/puppet/parser/ast/astarray.rb | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'lib/puppet/parser/ast/astarray.rb') 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) -- cgit