These experiments were also motivated by the problem of "Scene graph
operations and dispatch
<https://en.wikipedia.org/wiki/Scene_graph#Scene_graph_operations_and_dispatch>",
which can be more or less solved in C++ by using some tricks (e.g., the
"visitor pattern"), but which can be so-much-more-elegantly solved by
multiple dispatch in Julia.


On Fri, Nov 6, 2015 at 5:43 PM Cristóvão Duarte Sousa <[email protected]>
wrote:

>
> Around 0.000400 seconds (but sometimes 0.001000).
>
>
>
> On Fri, Nov 6, 2015 at 5:39 PM Stefan Karpinski <[email protected]>
> wrote:
>
>> I'm curious what the third timing number "yet another experiment" was for
>> the Julia code? I would imagine quite fast.
>>
>>
>> On Fri, Nov 6, 2015 at 12:37 PM, Stefan Karpinski <[email protected]>
>> wrote:
>>
>>> Looks like a reasonable benchmark of this. Nice work. There's definitely
>>> a lot of room for improvement of dynamic dispatch. We can't use classic
>>> vtables because of the multiple part of Julia's dispatch – where do you
>>> stick the vtable? Most of the time we get performance by avoiding dispatch
>>> entirely, by pushing the dispatch up as far as possible, but there are
>>> cases like what you've create here, where that doesn't work.
>>>
>>>
>>> On Fri, Nov 6, 2015 at 12:27 PM, Cristóvão Duarte Sousa <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I've been wondering how Julia dispatching system would compare to the
>>>> C++ virtual functions dispatch one.
>>>> Hence, I write a simple test in both Julia and C++ that measures the
>>>> calling of a function over the elements of both an array of concrete
>>>> objects and another of abstract pointers to objects of derived types.
>>>>
>>>> Here is the code https://gist.github.com/cdsousa/f5d669fe3fba7cf848d8 .
>>>>
>>>> The usual timings for C++ in my machine, for the concrete and the
>>>> abstract arrays respectively, are around
>>>> 0.000143 seconds
>>>> 0.000725 seconds
>>>>
>>>> For the Julia code the timings have much more variability, but they are
>>>> around
>>>> 0.000133 seconds
>>>> 0.002414 seconds
>>>>
>>>> This shows that Julia (single) dispatch performance is not that bad
>>>> while it has some room to improvement.
>>>>
>>>> If I'm doing something terribly wrong in these tests, please tell me :)
>>>>
>>>> PS: Thank you all, developers of Julia!
>>>>
>>>>
>>>>
>>>
>>

Reply via email to