[MacRuby-devel] Globbed method arguments (splat) Limit

John-Paul Bader hukl at berlin.ccc.de
Tue Sep 8 23:35:03 PDT 2009


Hey Laurent,

it took me a couple of days to ask my friend if I could forward his  
code which he agreed upon yesterday so here is a tar.bz2 containing  
all the code. We ran the »test/minheap_performance_test.rb«. Note that  
it contains lines (35, 43, 51) which use the large number of method  
arguments. Obviously one would not have to do it like that but he  
wanted to play around a bit. So to run the tests you would have to  
comment them out. But before that you can run them on ruby 1.9.1 to  
see how they are doing ;)

As said before this test ran faster on ruby 1.9.1 from macports on my  
mac book pro 4,1

Kind regards, John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ruffman.tar.bz2
Type: application/x-bzip2
Size: 4226 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090909/a5f4ef4d/attachment.bin>
-------------- next part --------------


On 05.09.2009, at 21:34, Laurent Sansonetti wrote:

> Hi,
>
> On Sep 5, 2009, at 3:11 AM, John-Paul Bader wrote:
>
>> Hey guys,
>>
>>
>> a friend of mine implemented a heap in ruby for educational  
>> purposes. He did so with several implementations. He had a few  
>> benchmarks and I suggested to run them on macruby to see how well  
>> it would hold up.
>>
>> Unfortunately we didn't get really far because apparently there is  
>> a problem with globbed/splatted method arguments in macruby which  
>> raises an exception if more than 199 arguments are passed.
>>
>> Can be tested easily with:
>>
>> def foo(*bar); puts bar.length;end
>> 1.upto(1000) {|x| foo(*([0]*x))}
>>
>> In vm.cpp:2977 #define MAX_DISPATCH_ARGS 200 is defined and a big  
>> fat todo is right below it addressing this issue. Now I know its  
>> not a super urgent problem because its not what you do in ruby  
>> every day. Still its obviously something that has to change.
>>
>> In line 3003 there is this assert: assert(real_argc + count <  
>> MAX_DISPATCH_ARGS);  so it must be important i guess.
>>
>> So i'm just wondering why it is limited to 200 in the first place  
>> and if there is something I can to even though I'm not really a  
>> capable (objective) c programmer ?
>
> This limitation is purely temporary and is because of a limitation  
> in the dispatcher. This will be addressed for the release.
>
>> After commenting out the code with the globbed arguments the  
>> benchmarks on the remaining tests ran a bit slower than on ruby  
>> 1.9.1.
>
> Can you share these benchmarks? I would be very interested to see  
> the results and also if we can be better.
>
> Laurent
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>



More information about the MacRuby-devel mailing list