ruby-changes:41046
From: hsbt <ko1@a...>
Date: Tue, 15 Dec 2015 16:20:29 +0900 (JST)
Subject: [ruby-changes:41046] hsbt:r53123 (trunk): * lib/erb.rb: Render erb with array buffer for function call optimization.
hsbt 2015-12-15 16:20:07 +0900 (Tue, 15 Dec 2015) New Revision: 53123 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53123 Log: * lib/erb.rb: Render erb with array buffer for function call optimization. [fix GH-1143] * lib/rdoc/erb_partial.rb: ditto. * template/verconf.h.tmpl: ditto. Modified files: trunk/ChangeLog trunk/lib/erb.rb trunk/lib/rdoc/erb_partial.rb trunk/template/verconf.h.tmpl Index: ChangeLog =================================================================== --- ChangeLog (revision 53122) +++ ChangeLog (revision 53123) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 15 16:19:26 2015 Takashi Kokubun <takashikkbn@g...> + + * lib/erb.rb: Render erb with array buffer for function call optimization. + [fix GH-1143] + * lib/rdoc/erb_partial.rb: ditto. + * template/verconf.h.tmpl: ditto. + Tue Dec 15 13:50:05 2015 Nobuyoshi Nakada <nobu@r...> * string.c (rb_str_oct): [DOC] mention radix indicators. Index: lib/rdoc/erb_partial.rb =================================================================== --- lib/rdoc/erb_partial.rb (revision 53122) +++ lib/rdoc/erb_partial.rb (revision 53123) @@ -11,7 +11,7 @@ class RDoc::ERBPartial < ERB https://github.com/ruby/ruby/blob/trunk/lib/rdoc/erb_partial.rb#L11 def set_eoutvar compiler, eoutvar = '_erbout' super - compiler.pre_cmd = ["#{eoutvar} ||= ''"] + compiler.pre_cmd = ["#{eoutvar} ||= []"] end end Index: lib/erb.rb =================================================================== --- lib/erb.rb (revision 53122) +++ lib/erb.rb (revision 53123) @@ -589,7 +589,7 @@ class ERB https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L589 end def add_insert_cmd(out, content) - out.push("#{@insert_cmd}((#{content}).to_s)") + out.push("#{@insert_cmd}((#{content}))") end # Compiles an ERB template into Ruby code. Returns an array of the code @@ -834,10 +834,10 @@ class ERB https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L834 # requires the setup of an ERB _compiler_ object. # def set_eoutvar(compiler, eoutvar = '_erbout') - compiler.put_cmd = "#{eoutvar}.concat" - compiler.insert_cmd = "#{eoutvar}.concat" - compiler.pre_cmd = ["#{eoutvar} = ''"] - compiler.post_cmd = ["#{eoutvar}.force_encoding(__ENCODING__)"] + compiler.put_cmd = "#{eoutvar}.push" + compiler.insert_cmd = "#{eoutvar}.push" + compiler.pre_cmd = ["#{eoutvar} = []"] + compiler.post_cmd = ["#{eoutvar}.join.force_encoding(__ENCODING__)"] end # Generate results and print them. (see ERB#result) Index: template/verconf.h.tmpl =================================================================== --- template/verconf.h.tmpl (revision 53122) +++ template/verconf.h.tmpl (revision 53123) @@ -52,7 +52,7 @@ https://github.com/ruby/ruby/blob/trunk/template/verconf.h.tmpl#L52 % R["exec_prefix"] = '"RUBY_EXEC_PREFIX"' % R["prefix"] = '"RUBY_EXEC_PREFIX"' % exec_prefix_pat = /\A"#{Regexp.quote(rbconfig::CONFIG['exec_prefix'])}(?=\/|\z)/ -% _erbout.gsub!(/^(#define\s+(\S+)\s+)(.*)/) { +% _erbout = [_erbout.join.gsub!(/^(#define\s+(\S+)\s+)(.*)/) { % pre, name, repl = $1, $2, $3 % pat = %["#{name}"] % c = C.merge(R.reject {|key, value| key == name or value.include?(pat)}) @@ -60,4 +60,4 @@ https://github.com/ruby/ruby/blob/trunk/template/verconf.h.tmpl#L60 % repl.gsub!(/^""(?!$)|(.)""$/, '\1') % repl.sub!(exec_prefix_pat, 'RUBY_EXEC_PREFIX"') % pre + repl -% } +% }] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/