On Apr 13, 2006, at 10:42 AM, Jeremy White wrote:
There's sv_isa, which should be cheaper than sv_derived_from at
the expense of not testing inheritance relationships. I dunno if
the overload affects impacts the ability to use it.
Yeah, it's cheaper - but not cheap enough:) I was playing around
with trying to upgrade the SV, and stuffing data in the free slots,
then using those slots to validate the type. Seemed to work for
simple examples, but blew up when used in the real world -
overloading makes things more complicated.
Moving stuff safely across the Perl/C boundary can be expensive.
Can you change the algorithm so that objects don't have to cross
so often?
Not really, as the object is exposed to the end user.
Maybe you could do something insane and heroic, like keep a registry
of pointer addresses that represent qualified objects. Something
like what David Golden does with Class::InsideOut to provide thread
safety. Add each object to the registry when it is created, delete
it when it's DESTROYed. It would require a lot of code, but I'll bet
it would be faster than sv_derived_from. How desperate are you?
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/