Sisyphus <[EMAIL PROTECTED]> writes: >Nick Ing-Simmons wrote: > >>>> >>>>The sv_2mortal _IS_ needed in the >>>> >>>>void >>>>my_xsub() >>>>CODE: >>>> { >>>> ST(0) = sv_2mortal(newSVpv(string,strlen(string)); >>>> XSRETURN(1); >>>> } >>>> >>>>case. >>>> >>>>But it is inserted for you SV * return case: >>>> >>>>{ >>>> RETVAL=newSV...; >>>>} >>>>#line 25 "Foo.c" >>>> ST(0) = RETVAL; >>>> sv_2mortal(ST(0)); >>>> } >>>> XSRETURN(1); >>>>} > >Case a: >void my_func() >I return a mortal SV via the stack. > >Case b: >SV * my_func() >I return an SV "directly". > >Let's see ... I'm being told that Case a and Case b are, wrt what gets >executed, exactly the same (or very nearly so) .... right ?
Yes - there are some {} in different places but guts is essentially identical. > >In both cases, a mortal SV is being returned via the stack ? - which >would go some way to explaining the similar performance of both "cases" :-) And the Case c: char *my_func() uses the TARG style - which is different. > >What's 'Foo.c', btw ? Output of xsubpp for a Foo.xs I slung together to see what got generated.