in reply to Re^3: XS/Inline::C concat *any* two SVs.
in thread XS/Inline::C concat *any* two SVs.
Right now, all is behaving, even w/o refcnt mess
The code in the OP does exactly what I need it to do. The equivalent of Perl's $scalar1 .= $scalar2;. Your version does not.
I want, and need to accumulate the appended data in the original SV.
The question is why do I need to increment the ref count, not how to avoid doing so. The problem with your approach is that you are completely discarding the benefits of Perl's dynamic string management.
Your code is roughly equivalent to
my $scalar3 = $scalar1; $scalar3 .= $scalar2;
Which is not what I need. I would have to do
my $scalar3 = $scalar1; $scalar3 .= $scalar2; $scalar1 = $scalar3;
to get what I need and that is very wasteful as this will be called many (100s) of times to append 4 bytes each time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: XS/Inline::C concat *any* two SVs.
by vkon (Curate) on May 28, 2006 at 22:08 UTC | |
by BrowserUk (Patriarch) on May 29, 2006 at 04:29 UTC | |
by vkon (Curate) on May 29, 2006 at 18:49 UTC | |
by BrowserUk (Patriarch) on May 30, 2006 at 05:59 UTC |