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? Cheers, jez.