From: Eric Hodel Date: 2005-05-04T07:45:47+09:00 Subject: Re: I rock. On 03 May 2005, at 15:21, Ryan Davis wrote: > On May 3, 2005, at 1:32 PM, Gyoung-Yoon Noh wrote: > >> Python has PyRex which enables writing CPython extensions >> with python-like syntax. I guess Ruby2RubyC can do a foundation >> role for future great works such as writing extensions with ruby >> syntax, enhancing performance easily with type conversion, >> or can be used as intermediate format for translating Ruby to C. > > Ruby2RubyC will probably not, for the first few months at least, > improve performance with any sort of type conversion at all. In fact, > I suspect that Eric's current version will start to get fairly severe > penalties until we move away from using rb_funcall for everything. Yup, it only bypasses the fast parts of eval.c (AST walking), and none of the slow parts (rb_funcall) so you get almost zero speed benefit out of it currently. (See the "time factorial(9999)" output further up the thread). > If you want performance then you should either hand write (using > RubyInline!) or take a peek at zenoptimizer when it gets released in > my ZenHacks package (it uses a combination of ruby2c and rubyinline > with a custom lightweight profiler I wrote last week). Yes. When you find a slow part, you could use this as your template. You'll have working Ruby/C code to refactor into faster C code in no time at all. I should be able to skip rb_funcall for places where I know the types, and directly call the C implementation of a method. That will be more work though, because I'll have to fall back in case a TypeError is raised in addition to pulling the right bits from the VALUE. Or something. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04