On 7/29/12 10:43 AM, Dmitry Olshansky wrote:
I'm horrified. Who was working on std.variant enhancements? Please chime
in.

I guess you just volunteered! When I looked at it this morning I noticed a few signs of bit rot, e.g. opAssign returns by value and such. (Only planting a "ref" there improves performance a good amount.)

Variant has a simple design with (in case of int) an int and a pointer to a function. Many of its operations incur an indirect call through that pointer. This makes operations slower than the time-honored design of using an integral tag and switching on it, but offers in return the ability to hold any type without needing to enumerate all types explicitly.

We can use the pointer to function as a tag for improving performance on primitive types.


Andrei


Reply via email to