[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.4-89-gcbbd363
James Turnbull
james at lovedthanlost.net
Tue May 18 09:04:47 UTC 2010
The following commit has been merged in the upstream branch:
commit 6739bab16e3126ccba13f025a4b47d38f15c1f67
Author: Markus Roberts <Markus at reality.com>
Date: Thu Apr 29 14:20:44 2010 -0700
Fix for #3558 -- source file reading speedup
It's about 10x faster to read the whole file than to read each line and
concatenate them (actually, it's O(n) vs. O(n^2), so the exact speedup
depends on the file size).
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index bb4fdf9..2c0943d 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -262,16 +262,10 @@ class Puppet::Parser::Lexer
return array
end
- # this is probably pretty damned inefficient...
- # it'd be nice not to have to load the whole file first...
def file=(file)
@file = file
@line = 1
- File.open(file) { |of|
- str = ""
- of.each { |line| str += line }
- @scanner = StringScanner.new(str)
- }
+ @scanner = StringScanner.new(File.read(file))
end
def find_string_token
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list