in reply to Re^12: Interleaving bytes in a string quickly
in thread Interleaving bytes in a string quickly

All you said was "I know the data I'd be passing are byte strings", implying you wouldn't be running into any problems because you always pass byte strings. I pointed out that's not true.

Wrong! I know what data I am dealing with. And I know how I'm going to use it. And I wrote the routine that you took it upn yourself to "correct" to deal with that data. Not your know-it-all flights of fancy.

You said: It can silently encode your bytes using UTF-8.. And where I'm going with this is trying to get you to realise that you're talking twaddle.

Data either originates from within my program, or from without. And in either case, Perl will treat it as bytes unless I do something explicit to indicate that it should do otherwise. And since I know I'm not going to do that, I do not have to consider it. It's termed YAGNI.

That's dealt with your second "correction", so let's deal with the third more succinctly.

For neither the purposes of the benchmark, nor those of the target application, magic could not be a consideration. Ergo, I did not need to cater for that either. So I didn't. And FYI: magic is never "free".


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.
"I'd rather go naked than blow up my ass"
  • Comment on Re^13: Interleaving bytes in a string quickly

Replies are listed 'Best First'.
Re^14: Interleaving bytes in a string quickly
by ikegami (Patriarch) on Feb 27, 2010 at 04:00 UTC

    Wrong!

    What's wrong? The bold part? I did that in Re^6: Interleaving bytes in a string quickly.

    Perl will treat it as bytes unless I do something explicit to indicate that it should do otherwise

    Yes, but SvPVX won't.

    And FYI: magic is never "free"

    I said supporting magic is free. I never said magic is free.

      Yes, but SvPVX won't.

      You're still at it aren't you. Trying to pretend (or at least imply), that you know something special. Back there a ways I was willing to give you the benefit of the doubt, so I asked you to explain yourself. You haven't.

      So, I'll make an assertion: SvPVX cannot treat it's target SV as anything! Bytes. UTF_whatever. Or flying ducks.

      All SvPVX can do is return the address held in the pv slot, or die if it is a readonly scalar.


      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.

        I asked you to explain yourself. You haven't.

        You seem to have missed Re^8: Interleaving bytes in a string quickly? If sv contains the byte string "\x80\x81", the pointer returned by SvPVX(sv) points to one of the following:

        • two bytes 80 81*
        • three bytes 80 81 00
        • four bytes C2 80 C2 81*
        • five bytes C2 80 C2 81 00

        * — These tend to be considered bugs.