[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:32:45 UTC 2010
The following commit has been merged in the upstream branch:
commit 088c80148d1fa082ac6f79023739bc268d096bc0
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 2a1f88e..f13a85f 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -286,16 +286,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 shift_token
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list