[MacRuby-devel] [NEW FILE] add string performance tests
Laurent Sansonetti
lsansonetti at apple.com
Thu May 27 13:47:10 PDT 2010
I would recommend using strings, but you can assign them to local variables then reuse these.
a = 'a'
...
while...
str << a
There is no doubt we also need to optimize literal strings but this can be done in another (separate) test.
Laurent
On May 27, 2010, at 1:39 PM, Jordan Breeding wrote:
> Good point, what if I change to appending binary info?
>
> str << 1
>
> vs.
>
> str << "1"
>
> On May 27, 2010, at 15:37, Laurent Sansonetti wrote:
>
>> Hi Jordan,
>>
>> The perf suite is far to be completed but we will definitely cover most String methods there at some point. In the meantime, your tests have some side effects I'm afraid (literal strings in loops are object creations).
>>
>> Laurent
>>
>> On May 26, 2010, at 9:09 PM, Jordan Breeding wrote:
>>
>>> Right now MacRuby is really quite slow for string operations, I noticed it a while back when doing large amounts of string creation, characters swapping, and pushing/popping strings into/out of a priority queue.
>>>
>>> The attached file is a string performance test and here is a run on my 15" Core i7 MBP with ruby 1.9.1, jruby, and MacRuby:
>>>
>>> Name ruby 1.9.1p378 MacRuby version jruby 1.5.0.RC1
>>> --------------------------------------------------------------------------------
>>> array:<< 0.751082 1.168693 1.290000
>>> array:new 0.394997 1.917601 0.277000
>>> array:[] 0.324454 0.755054 0.472000
>>> array:[]= 1.691840 0.765225 0.822000
>>> hash:new 1.501595 4.563549 0.444000
>>> hash:[] 0.612701 1.051502 0.589000
>>> hash:[]= 2.012367 1.135856 0.902000
>>> ivar:get 0.215424 0.344873 1.087000
>>> ivar:set 1.349466 0.243909 1.902000
>>> ivar:attr_writer 1.245894 4.587488 0.655000
>>> ivar:attr_reader 1.045779 2.755303 0.482000
>>> loop:upto 1.211598 5.215169 0.874000
>>> loop:times 1.210781 5.215054 0.876000
>>> loop:while 0.599330 0.157019 0.937000
>>> loop:for 1.442154 0.811875 1.132000
>>> method:args 0.728248 0.682097 1.434000
>>> method:noarg 0.822463 0.578383 0.837000
>>> method:splat 0.478610 1.805760 0.227000
>>> method:empty 0.807405 0.527851 1.062000
>>> method:opt 1.027146 2.579715 0.944000
>>> misc:ao_bench 7.838053 8.529954 3.248000
>>> misc:sudoku 1.740196 2.172581 2.461000
>>> misc:tak 1.277399 0.155534 1.563000
>>> misc:mandelbrot 2.956319 0.124588 0.854000
>>> misc:fib 3.827194 0.574900 4.935000
>>> misc:ack 1.049100 0.116299 1.217000
>>> proc:call+splat 0.318346 1.119665 0.191000
>>> proc:call+args 2.477112 1.100848 2.995000
>>> proc:call+noarg 2.496278 1.071953 3.507000
>>> string:store swap 0.153784 0.479202 0.033000
>>> string:<< 0.481788 143.615735 0.099000
>>> string:new 0.276954 1.574715 0.207000
>>> string:[] 0.428182 1.899233 0.072000
>>> string:tuple swap 0.181318 0.721778 0.045000
>>> yield:noarg 0.783281 0.720254 1.269000
>>> yield:splat 0.159219 0.965713 0.094000
>>> yield:less_arity 0.192418 0.843867 0.345000
>>> yield:same_arity 0.937823 0.763344 1.547000
>>> yield:more_arity 0.192516 0.848179 0.421000
>>>
>>> Jordan
>>>
>>> <perf_string.rb>_______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> _______________________________________________
> 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