On Mon, Jan 2, 2012 at 8:57 AM, Joel Falcou <joel.fal...@lri.fr> wrote:
> Compiles in C++11 mode : --std=c++0x
Just tried this on boost 1.48, no change in time or memory usage. Or
is this even newer than 1.48?
> type erasure allow your template class to inherit from a single,
> non-template base class that forward its evaluation to its actual
> derived class via a single virtual member function entry-point.
> At some point, you need to do this or your CT just explode. And for your
> performance matter, I think it need to be benched, type erased calls usually
> are no more than some cycles slower to call.
Yes, in a way we are already doing this, only the virtual call is a
"loop" function that executes the inner loop, so beaking things up
further would be possible, but this would incur redundant loops over
the mesh. Moving the virtual call down further, i.e. inside the inner
loop, would not only be costly because of the virtual call, but also
because we would need to use dynamic-size matrices in that case. Right
now, all matrix operations use fixed-size matrices (from the Eigen
library) and I would guess that losing those would be a bigger hit
than the virtual call alone.
That said, you did give me a new idea: having a low-level type-erased
expression would allow the addition of dynamic "hooks" on our
algorithms, where we can add extra equations more dynamically. I'll
have to think of a way to do this in practice, at first sight passing
the data (as in the proto "data" argument) might pose problems, since
this is strongly typed.
Many thanks for the answers, as always it's been very helpful!
proto mailing list