Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Threads and fork and CLONE, oh my!

by xdg (Monsignor)
on Aug 17, 2005 at 15:40 UTC ( [id://484475]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Threads and fork and CLONE, oh my!
in thread Threads and fork and CLONE, oh my!

I sort of meant that tongue-in-cheek... but the benchmarks are neat to see. Actually I mean 'cheap' to use $self as opposed to some other "guaranteed" unique ID like a UUID (e.g. Data::UUID). I suspect that any of the $self as index variations will be faster than a UUID-as-index variation.

I've also pondered a lighter-weight, pure-perl alternative like packing Time::HiRes::gettimeofday() and the memory address of an anoymous lexical during construction, as a memory address at a point in time should be unique on a single machine and "global" uniqueness isn't so much an issue for this kind of object ID.

On the other hand, I'm personally moving away from the unique ID answer as CLONE works for those few who dare to muck with threads, and I don't think the performance hit of sharing objects across threads for those few people who might want it is going to be worth giving up the promiscuous nature of inside-out objects as a general property.

(And for the next headache/magic-trick I'm considering with Object::LocalVars: trying out lexical closures to anonymous globrefs instead of package globals for storage to give local aliasing and encapsulation. And then see if I can get it running without too much of a performance hit against other options. Sign me up for The Perl Crackpot Index, I guess.)

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

  • Comment on Re^4: Threads and fork and CLONE, oh my!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2024-04-18 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found