|
Boost : |
Subject: Re: [boost] Request for interest in a library to ease double dispatching
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-12-03 12:55:07
On 12/03/12 11:40, Larry Evans wrote:
> On 12/03/12 08:13, Per Karlström wrote:
[snip]
>> I have been tinkering on a template library to ease the use of double
>> dispatching. Now I know there are other techniques such as visitor
>> patterns that might solve this problem in a more general way. However I
>> believe that there are occasions when using double dispatch is a good
>> way forward. I have some excerpts of example code at the end of this mail.
>>
>> Of course if I somehow have missed a boost library that already handles
>> this I would be happy to know about it.
[snip]
>
> There's multiple dispatch code here:
>
>
> http://svn.boost.org/svn/boost/sandbox/variadic_templates/libs/composite_storage/sandbox/pack/
>
> The predator_prey.cpp uses virtual functions for dispatching.
> The one_of_multiple_dispatch.test.cpp
> uses either virtual functions or switches to do the dispatching.
>
> Unfortunately, I found the timing was pretty slow on the
> one_of_multiple_dispatch vs. the variant visitor :(
I meant the compile times were slow. I didn't bother with
runtimes. Also, I provided a switch implementation because
others (in this NG, IIRC) have said that was faster than
virtual functions for dispatching.
Anyway, the timing results are attached for a clang compiler.
The table shows the ratio of the times w.r.t. an implementation
called CLOPTR, which was posted in the earlier post on boost.user:
From: Paul <peebor_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.user
Subject: Re: large variant performance compared (50 elements)
Date: Thu, 27 Jan 2011 20:19:08 +0100
-regards,
Larry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk