----- Original Message ----- 
From: "Sisyphus" <[EMAIL PROTECTED]>

>
> One problem here is that addString() creates a new SV at each iteration.
> That could be worth avoiding if you're calling lots of iterations ... not
> sure .... perhaps the overhead isn't that great in relation to the overall
> time taken.
> (I'll take a closer look later when I have more time.)
>

This is more what I was thinking of:

------------------------------
use warnings;
package DSTRING;

use Inline C => Config =>
    BUILD_NOISY => 1; # see the compilation report

use Inline C => <<'END_C';

void addString (SV * data , char * str2){
   sv_catpv(data, str2);
}

END_C

my $data = "";

my $count = 0;
for(1...10) # keep it brief for the demo
{
print $count,"\n";

DSTRING::addString($data,"testdata"); # don't assign the return to $data
$count++;
}

print "DATA: $data\n";

print "END\n";
------------------------------

I don't know if that works any more efficiently than what was posted
earlier. It looks like it should .... but one can never be too sure with
perl (unless one understands what's happening underneath).

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to