Hi Nakatani-san,

That was really helpful information. I digged a bit more based upon
that thread, and for those who compile Ruby 1.8.7 from source on OS X,
here's a more handy way: add 'ac_cv_func_getcontext=no
ac_cv_func_setcontext=no' along with --enable-pthread, e.g.:
./configure --enable-pthread --enable-shared ac_cv_func_getcontext=no
ac_cv_func_setcontext=no

Then the following lines won't appear on your config.h:
#define HAVE_GETCONTEXT 1
#define HAVE_SETCONTEXT 1

Just my 2 cents,
Jason

On 11月3日, 下午6时01分, nakatani katsumi <al... / kcat.zaq.ne.jp> wrote:
> Hi
>
> On Sat, 1 Nov 2008 19:58:54 +0900
>
> abc <arcadiorubiogar... / gmail.com> wrote:
> > I've just upgraded to Ruby 1.8.7 using MacPorts (ruby @1.8.7-
> > p72_1+thread_hooks) and while it runs flawlessly, the performance is
> > really really poor.
> > Is anyone experiencing the same problem? Do you know how to fix it?
>
> The same problem reported at ruby-list-45593.(but Japanese only)
>
> Summary is below.
> 1. On MacOS X(10.5.5), Ruby1.8.7(p72) compiled with --enable-pthread excute slowly,
>    as Ruby use time of 70% at rb_call()->getcontext() in fib.rb
>
> 2. In MacPorts, ./configure with --enable-pthread option makes config.h using getcontext
> like below
> #define HAVE_GETCONTEXT 1
> #define HAVE_SETCONTEXT 1
>
> 3. If you comment out these two lines, you will get normal speed Ruby1.8.7.
>
> 4. As Ruby1.9 don't use getcontext()/setcontext(), Ruby1.9 don't care --enable-pthread.