[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5
James Turnbull
james at lovedthanlost.net
Wed Apr 8 21:48:18 UTC 2009
The following commit has been merged in the master branch:
commit e2b406239eaa255c41acb31942169296bea71948
Author: Luke Kanies <luke at madstop.com>
Date: Fri Feb 13 00:46:45 2009 -0600
Adding a performance optimization to the FileCollection.
I saw about a 7x speed increase when adding this simple
hash to speed up the file index lookup.
Signed-off-by: Luke Kanies <luke at madstop.com>
diff --git a/lib/puppet/file_collection.rb b/lib/puppet/file_collection.rb
index 69f59ff..7db2600 100644
--- a/lib/puppet/file_collection.rb
+++ b/lib/puppet/file_collection.rb
@@ -9,14 +9,16 @@ class Puppet::FileCollection
def initialize
@paths = []
+ @inverse = {}
end
def index(path)
- if @paths.include?(path)
- return @paths.index(path)
+ if i = @inverse[path]
+ return i
else
@paths << path
- return @paths.length - 1
+ i = @inverse[path] = @paths.length - 1
+ return i
end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list