Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Percentage of time spent in method dispatch?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Dominik Bathon, post: 4522581"] Hi, Here are some numbers. Running this code: max =3D 2000 z =3D x =3D 0 while (x+=3D1) <=3D max y =3D 0 while (y+=3D1) <=3D max z =3D (x+y-z) % 32000 end end takes about 5.5s in plain Ruby 1.8.4 (on my machine). Compiling it with Ruby2CExtension (latest version, all optimizations = turned on) and then running it takes about 0.9s. One of the optimizations is to bypass rb_call and calling the C function= s = of those methods (almost) directly (when possible). If this optimization is turned off then running the compiled code takes = = about 3.1s. These additional 2.2s are all spent for method dispatch. Plain Ruby spends at least the same time for method dispatch, so Ruby = spends at least 40% of the time doing method dispatch (in this case). I hope that helps, Dominik [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Percentage of time spent in method dispatch?
Top