in reply to Re^2: XS: SvPVLV examples?
in thread XS: SvPVLV examples?

I disagree. If you are dealing with numeric data in its binary form, you will always have to do some pre and post processing of the binary values

That has nothing to do with whether you use

++( $mmap->uint8(0x1234) );
or the faster
$mmap->preinc_uint8(0x1234);

Now, using magic allows you to reuse existing code (like the ++ operator), so I thought you'd be willing to absorb the cost. That's why I proceeded.

It would be easier to follow if the posts were in a single contiguous thread rather than scattered around.

Then depth of the thread was causing problems. I took the fresh start from actually breaking out of the XY problem as a good point to restart. Your post actually forks that new branch.

Replies are listed 'Best First'.
Re^4: XS: SvPVLV examples?
by BrowserUk (Patriarch) on Sep 25, 2009 at 21:13 UTC

    How about the even faster:++ u8( $mmap, 0x12346789abcd );

    or faster and simpler

    my $uchar = u8( $mmap, 0x12346789abcd ); ++$$uchar if cond; $$uchar *= 3;

    I've seen much deeper threads and never seen it as a problem.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Even then, I bet avoiding magic is still faster.
      my $byte = u8( $mmap, 0x12346789abcd ); ++$byte if cond; u8( $mmap, 0x12346789abcd, $byte * 3 );

      If you search PM, you'll find benchmarks between 4-arg and l-lvalue substr. I don't remember how much slower the latter is, but it's quite a bit slower.