optimize performance of `rb_str_resurrect` #1050

Closed
wants to merge 3 commits into
from

Conversation

2 participants
@kazuho

kazuho commented Oct 8, 2015

Thank you for applying the proposed approach in e2cabc2.

Unfortunately, there were issues in the commit (and other related commits) that failed to gain the maximum from the division of fast and slow passes. This PR addresses the issue.

The numbers I see when running the code below is as follows:

compiler trunk this PR
gcc 4.8.2 (linux) 1.31 1.27
gcc 5.1.0 (OS X) 1.49 1.42
clang-600.0.56 (OS X) 1.58 1.51

benchmark code:

require "benchmark"
N = 20_000_000
GC.start; GC.start # magic
Benchmark.bm{|bm|
  bm.report{N.times{str = "a"}}
}

@hsbt hsbt assigned ko1 Oct 8, 2015

ko1 added a commit that referenced this pull request Oct 10, 2015

* import a github pull request
  #1050
  by Kazuho Oku <kazuho@natadeco.co>.
  This pull request has the following commits.
* gc.c: reduce # of args to 6 (max. of register args on x86-64) so
  that the `newobj_of_slowpass` can be called via TCO.
* gc.c (newobj_of), string.c (str_duplicate): for performance,
  the hot functions must be inlined.
* gc.c: for performance, preceding arguments of `.*newobj_of.*`
  must be same, so that the arg registers can be reused in case of
  TCO.



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

This comment has been minimized.

Show comment
Hide comment
@ko1

ko1 Oct 10, 2015

Contributor

merged.

Contributor

ko1 commented Oct 10, 2015

merged.

@ko1 ko1 closed this Oct 10, 2015

sonots pushed a commit to sonots/ruby that referenced this pull request Nov 17, 2015

* import a github pull request
  ruby#1050
  by Kazuho Oku <kazuho@natadeco.co>.
  This pull request has the following commits.
* gc.c: reduce # of args to 6 (max. of register args on x86-64) so
  that the `newobj_of_slowpass` can be called via TCO.
* gc.c (newobj_of), string.c (str_duplicate): for performance,
  the hot functions must be inlined.
* gc.c: for performance, preceding arguments of `.*newobj_of.*`
  must be same, so that the arg registers can be reused in case of
  TCO.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment