Project

General

Profile

Actions

Bug #12074

closed

[PERF] bm_app_erb.rb slower

Added by tgxworld (Guo Xiang Tan) over 8 years ago. Updated over 7 years ago.

Status:
Closed
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 :)

Updated by k0kubun (Takashi Kokubun) over 7 years ago

  • Assignee set to k0kubun (Takashi Kokubun)
Actions #2

Updated by k0kubun (Takashi Kokubun) over 7 years 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.

[ruby-core:73820] [Bug #12074]

Actions

Also available in: Atom PDF

Like0
Like0Like0