Hi,

While wrapping up my compiler performance patch (soon to be released), I
stumbled on this test (in compiler_spec.rb):

it "should fail to add resources that conflict with existing resources" do
  path = make_absolute("/foo")
  file1 = Puppet::Type.type(:file).new :path => path
  file2 = Puppet::Type.type(:file).new :path => path

  @compiler.add_resource(@scope, file1)
  lambda { @compiler.add_resource(@scope, file2) }.should
raise_error(Puppet::Resource::Catalog::DuplicateResourceError)
end

I'm wondering what's the point in adding already compiled RAL resources
to a compiler, especially when those are even not inheriting from
Puppet::Resource.

The reason I'm asking this is that I added two methods to
Puppet::Resource (namely class? and stage?) to prevent the DRY smell of
doing:
resource.type.to_s.downcase == "stage" (and equivalent for "class")

My intent was to reduce the number of times this code structure is
executed during a compilation (mainly to prevent creation of so many
short-lived String objects).

Did I miss anything obvious?
-- 
Brice Figureau
My Blog: http://www.masterzen.fr/

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to