Jeremy White wrote:
Just done some performance testing with this type map:

   if(SvROK($arg)) {
       SV** out=hv_fetch((HV*)SvRV($arg), \"-handle\", 7, 0);
       if(out != NULL)
           $var = ($type) SvIV(*out);
       else
           $var = NULL;
   } else
       $var = ($type) SvIV($arg);

Benchmark: timing 1000000 iterations of NewTypeMap, OldTypeMap...
NewTypeMap: 29 wallclock secs (29.64 usr + 0.06 sys = 29.70 CPU) @ 33666.63/s (
n=1000000)
OldTypeMap: 38 wallclock secs (38.22 usr + 0.02 sys = 38.23 CPU) @ 26154.05/s (
n=1000000)

Thoughts?

I'm no typemap expert, but don't see anything wrong with that. Indeed, only doing the hv_fetch once seems like an obvious improvement. If you can hold onto the code until after the next release, then we can get it into CVS for the following release?

Rob.

Reply via email to