Skip to content

Commit ec7a964

Browse files
committed
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 365fae4 commit ec7a964

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Tue Dec 15 16:19:26 2015 Takashi Kokubun <[email protected]>
2+
3+
* lib/erb.rb: Render erb with array buffer for function call optimization.
4+
[fix GH-1143]
5+
* lib/rdoc/erb_partial.rb: ditto.
6+
* template/verconf.h.tmpl: ditto.
7+
18
Tue Dec 15 13:50:05 2015 Nobuyoshi Nakada <[email protected]>
29

310
* string.c (rb_str_oct): [DOC] mention radix indicators.

lib/erb.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def add_put_cmd(out, content)
589589
end
590590

591591
def add_insert_cmd(out, content)
592-
out.push("#{@insert_cmd}((#{content}).to_s)")
592+
out.push("#{@insert_cmd}((#{content}))")
593593
end
594594

595595
# Compiles an ERB template into Ruby code. Returns an array of the code
@@ -834,10 +834,10 @@ def location=((filename, lineno))
834834
# requires the setup of an ERB _compiler_ object.
835835
#
836836
def set_eoutvar(compiler, eoutvar = '_erbout')
837-
compiler.put_cmd = "#{eoutvar}.concat"
838-
compiler.insert_cmd = "#{eoutvar}.concat"
839-
compiler.pre_cmd = ["#{eoutvar} = ''"]
840-
compiler.post_cmd = ["#{eoutvar}.force_encoding(__ENCODING__)"]
837+
compiler.put_cmd = "#{eoutvar}.push"
838+
compiler.insert_cmd = "#{eoutvar}.push"
839+
compiler.pre_cmd = ["#{eoutvar} = []"]
840+
compiler.post_cmd = ["#{eoutvar}.join.force_encoding(__ENCODING__)"]
841841
end
842842

843843
# Generate results and print them. (see ERB#result)

lib/rdoc/erb_partial.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class RDoc::ERBPartial < ERB
1111
def set_eoutvar compiler, eoutvar = '_erbout'
1212
super
1313

14-
compiler.pre_cmd = ["#{eoutvar} ||= ''"]
14+
compiler.pre_cmd = ["#{eoutvar} ||= []"]
1515
end
1616

1717
end

template/verconf.h.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@
5252
% R["exec_prefix"] = '"RUBY_EXEC_PREFIX"'
5353
% R["prefix"] = '"RUBY_EXEC_PREFIX"'
5454
% exec_prefix_pat = /\A"#{Regexp.quote(rbconfig::CONFIG['exec_prefix'])}(?=\/|\z)/
55-
% _erbout.gsub!(/^(#define\s+(\S+)\s+)(.*)/) {
55+
% _erbout = [_erbout.join.gsub!(/^(#define\s+(\S+)\s+)(.*)/) {
5656
% pre, name, repl = $1, $2, $3
5757
% pat = %["#{name}"]
5858
% c = C.merge(R.reject {|key, value| key == name or value.include?(pat)})
5959
% rbconfig.expand(repl, c)
6060
% repl.gsub!(/^""(?!$)|(.)""$/, '\1')
6161
% repl.sub!(exec_prefix_pat, 'RUBY_EXEC_PREFIX"')
6262
% pre + repl
63-
% }
63+
% }]

0 commit comments

Comments
 (0)