Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^6: Fastest byteswap (little endian to big endian (eg. 34127856 -> 12345678)

by Eily (Monsignor)
on Apr 15, 2015 at 08:06 UTC ( [id://1123475]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Fastest byteswap (little endian to big endian (eg. 34127856 -> 12345678)
in thread Fastest byteswap (little endian to big endian (eg. 34127856 -> 12345678)

No idea about the downvote, but with no comment to go with it, you might as well pretend it's not there. And yes, I do agree that this code probably falls out of COW's scope (that's what I meant by "not copied from one variable to another"), as I said I overlooked that part.

  • Comment on Re^6: Fastest byteswap (little endian to big endian (eg. 34127856 -> 12345678)

Replies are listed 'Best First'.
Re^7: Fastest byteswap (little endian to big endian (eg. 34127856 -> 12345678)
by ikegami (Patriarch) on Apr 15, 2015 at 14:07 UTC

    I didn't say COW couldn't happen here; I said I didn't think COW would help here.

    I'm not sure what you think is being assigned from, but it is indeed a scalar, and thus COW could apply. However, if it does, it might simply replace another pre-existing optimization. This optimization allows a scalar to steal the string buffer of the scalar being assigned to it (i.e. copy the pointer instead of copying the whole buffer). This is only done if the scalar being assigned is a "temp" about to be destroyed (I'm sure what the exact condition is.)

      I said the copy was not from a variable to another, because the RHS is just an anonymous value, scalar, string, or whatever else it could have been. I was basically saying that I agree with you, since the RHS is not something that has to be kept, my first post may not have been relevant.

        You keep saying you're agreeing with me, yet you are saying exactly the opposite. I'm saying that it is a variable — a scalar, to be precise — so it can COW.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1123475]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-24 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found