Call for Cooperation: CFUNC usage survey

Hi,

I want to survey the Ruby interpreter usage.

If you have

  • a real application on Ruby 1.9 trunk
    if that application has a performance issue, it is welcome.
  • the build environment
  • time

please cooperate me to survey the CFUNC usage.

Procedure:
(1) Check out ruby trunk
$ svn co http://svn.ruby-lang.org/repos/trunk
(2) Apply a patch which is attached to this mail
(3) Build ruby interpter and install it
(4) Run application on the interpreter
Ruby prints the results into STDERR at the end of ruby process.

  $ ruby [application] 2> result

(5) Send me the result with
- your environment (ruby -v)
- brief description of your application.

  Download-able URL instead of attaching the result is preferable
  because the result will be a huge text file.

(6) Do not forget to remove (or invalidate) installed Ruby

Result:
The results show the usage of CFUNC. CFUNC is methods implemented in C.

method_name [shallow count] [deep count] ...

[shallow count] means the number of invoking the method named
[method_name] without invoking the other methods (and blocks, and so
on). [deep count] is the number of invoking which invoke other methods.

result sample (sorted by Excel):
http://www.atdot.net/sp/view/fmjbal
application: rdoc (build process)
environment: ruby 1.9.3dev (2010-10-14) [i686-linux]

Purpose:

To tune the VM. I can find out which CFUNC method / what kind of
methods should be faster.

Thank you for.

Regards,
Koichi


Japanese ($B$K$[$s$4(B):

$B!!(BCFUNC
$B$,$I$s$J46$8$G;H$o$l$F$k$+CN$j$?$$$N$G!“%Q%C%A$”$F$F<B9T$7$F!“7k(B
$B2L$rAw$C$F2<$5$k$H=u$+$j$^$9!#7k2L$O!”%W%m%;%9=*N;;~$KI8=`%(%i!<=PNO$K=P(B
$B$^$9!J@53N$K$O!"%9%l%C%I$,2s<}$5$l$k$H$-$K%9%l%C%I8e$N$K=PNO!K!#(B

1.9 $B$N%j%“%k%”%W%j%1!<%7%g%s$C$F$I$l$/$i$$$"$k$s$@$m!#(B

Hi,

Thank you for your help. I can find out (confirm) several
characteristic of Ruby application.

(Unfortunately, no Rails related result are collected).

Fig.1 Results
For the each application, the result sorted by
shallow count (descending order)
deep count (ascending order)
http://www.atdot.net/fp/view/dvhlal

Fig.1 shows the result of this survey.

Insights:

(1) We can observe same tendency for all applications.
(2) Most of CFUNC invocation is “shallow” invocation.
(3) Small amount of methods account for the invocation count.
(4) Shallow/frequent method names (not available in pictures).

Next:

We can develop:

(1) Mechanism to invoke shallow/frequent methods

In fact, this is the reason why I make this survey. Currently, we have
specialized instructions in Ruby 1.9 virtual machine. However, to add
new specialized instructions, we need to modify VM code. We want to
extend this feature more general.

(2) Make some deep methods to shallow method

Reading the source code of some deep methods, unnecessary method
invocation can be observed. We can get rid of such inefficient methods
calls.

(3) Revise frequent called methods.

Thank you for your help, again.

Regards,
Koichi


In Japanese
$B$K$[$s$4(B

$B$"$j$,$H$&$4$6$$$^$7$?!#$$$/$D$+:GE,2=$K4X$9$k%R%s%H$rF@$k$3$H$,$G$-$^$7$?!#(B


// SASADA Koichi at atdot dot net

Hi,

Thank you for your help. I can find out (confirm) several
characteristic of Ruby application.

(Unfortunately, no Rails related result are collected).

Fig.1 Results
For the each application, the result sorted by
shallow count (descending order)
deep count (ascending order)
http://www.atdot.net/fp/view/dvhlal

Fig.1 shows the result of this survey.

Insights:

(1) We can observe same tendency for all applications.
(2) Most of CFUNC invocation is “shallow” invocation.
(3) Small amount of methods account for the invocation count.
(4) Shallow/frequent method names (not available in pictures).

Next:

We can develop:

(1) Mechanism to invoke shallow/frequent methods

In fact, this is the reason why I make this survey. Currently, we have
specialized instructions in Ruby 1.9 virtual machine. However, to add
new specialized instructions, we need to modify VM code. We want to
extend this feature more general.

(2) Make some deep methods to shallow method

Reading the source code of some deep methods, unnecessary method
invocation can be observed. We can get rid of such inefficient methods
calls.

(3) Revise frequent called methods.

Thank you for your help, again.

Regards,
Koichi


In Japanese
$B$K$[$s$4(B

$B$"$j$,$H$&$4$6$$$^$7$?!#$$$/$D$+:GE,2=$K4X$9$k%R%s%H$rF@$k$3$H$,$G$-$^$7$?!#(B


// SASADA Koichi at atdot dot net

On Thu, Oct 21, 2010 at 01:05:12AM +0900, SASADA Koichi wrote:

Hi,

Thank you for your help. I can find out (confirm) several
characteristic of Ruby application.

(Unfortunately, no Rails related result are collected).

ActiveRecord tests with sqlite3-ruby, postgres, mysql, and mysql2:

http://tenderlovemaking.com/result_sqlite3
http://tenderlovemaking.com/result_postgresql
http://tenderlovemaking.com/result_mysql
http://tenderlovemaking.com/result_mysql2

Nokogiri tests:

http://tenderlovemaking.com/result_nokogiri

On Thu, Oct 21, 2010 at 01:05:12AM +0900, SASADA Koichi wrote:

Hi,

Thank you for your help. I can find out (confirm) several
characteristic of Ruby application.

(Unfortunately, no Rails related result are collected).

May I give you results later? Currently the rails tests are not running
with 1.9.3. I’m working to make the Rails tests run on 1.9.3.

(2010/10/20 22:49), Aaron P. wrote:

ActiveRecord tests with sqlite3-ruby, postgres, mysql, and mysql2:

http://tenderlovemaking.com/result_sqlite3
http://tenderlovemaking.com/result_postgresql
http://tenderlovemaking.com/result_mysql
http://tenderlovemaking.com/result_mysql2

Nokogiri tests:

http://tenderlovemaking.com/result_nokogiri

Thank you!
BTW, practical applications are more better for this purpose.