Project

General

Profile

Bug #12074

[PERF] bm_app_erb.rb slower

Added by tgxworld (Guo Xiang Tan) over 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-01-02 trunk 53412)
[ruby-core:73820]

Description

Hi I'm noticing a regression on RubyBench for bm_app_erb.rb

http://rubybench.org/ruby/ruby/commits?result_type=app_erb&display_count=2000

Narrowed down to https://github.com/ruby/ruby/commit/32b4a8b

Results on my local machine confirms it as well:

total: 2 trial(s) (2 trial(s) for 1 benchmark(s))
..
-----------------------------------------------------------
benchmark results:
Execution time (sec)
name  ruby 2.4.0dev (2016-01-02 trunk 53411) [x86_64-linux]
Posting results to Web UI....
app_erb 0.614
total: 2 trial(s) (2 trial(s) for 1 benchmark(s))
..
-----------------------------------------------------------
benchmark results:
Execution time (sec)
name  ruby 2.4.0dev (2016-01-02 trunk 53412) [x86_64-linux]
Posting results to Web UI....
app_erb 0.911

Let me know if I can provide more information :)

Associated revisions

Revision 72fb1e16
Added by k0kubun (Takashi Kokubun) about 1 year ago

erb.rb: Skip creating regexp

if stags and etags are not changed from default.

:putobject insn (of regexp) will be used instead of :toregexp insn.
This means that the regexp won't be compiled for every
SimpleScanner#scan call.

It may not be a good idea to apply this kind of optimization for all cases.
But I applied this because it is default scanner and used frequently and has
relatively large impact for benchmark like this:

  • Before
    app_erb 1.023

  • After
    app_erb 0.781

This commit fixes only the bottleneck of performance regression introduced
in r53412. For maintainability, I won't fix other small regressions like
additional overhead of method calls.

[Bug #12074]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 58842
Added by k0kubun (Takashi Kokubun) about 1 year ago

erb.rb: Skip creating regexp

if stags and etags are not changed from default.

:putobject insn (of regexp) will be used instead of :toregexp insn.
This means that the regexp won't be compiled for every
SimpleScanner#scan call.

It may not be a good idea to apply this kind of optimization for all cases.
But I applied this because it is default scanner and used frequently and has
relatively large impact for benchmark like this:

  • Before
    app_erb 1.023

  • After
    app_erb 0.781

This commit fixes only the bottleneck of performance regression introduced
in r53412. For maintainability, I won't fix other small regressions like
additional overhead of method calls.

[Bug #12074]

Revision 58842
Added by k0kubun (Takashi Kokubun) about 1 year ago

erb.rb: Skip creating regexp

if stags and etags are not changed from default.

:putobject insn (of regexp) will be used instead of :toregexp insn.
This means that the regexp won't be compiled for every
SimpleScanner#scan call.

It may not be a good idea to apply this kind of optimization for all cases.
But I applied this because it is default scanner and used frequently and has
relatively large impact for benchmark like this:

  • Before
    app_erb 1.023

  • After
    app_erb 0.781

This commit fixes only the bottleneck of performance regression introduced
in r53412. For maintainability, I won't fix other small regressions like
additional overhead of method calls.

[Bug #12074]

History

#1 [ruby-core:81309] Updated by k0kubun (Takashi Kokubun) over 1 year ago

  • Assignee set to k0kubun (Takashi Kokubun)

#2 Updated by k0kubun (Takashi Kokubun) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset trunk|r58842.


erb.rb: Skip creating regexp

if stags and etags are not changed from default.

:putobject insn (of regexp) will be used instead of :toregexp insn.
This means that the regexp won't be compiled for every
SimpleScanner#scan call.

It may not be a good idea to apply this kind of optimization for all cases.
But I applied this because it is default scanner and used frequently and has
relatively large impact for benchmark like this:

  • Before
    app_erb 1.023

  • After
    app_erb 0.781

This commit fixes only the bottleneck of performance regression introduced
in r53412. For maintainability, I won't fix other small regressions like
additional overhead of method calls.

[Bug #12074]

Also available in: Atom PDF