Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: [RFC] Stringifying a thread

by jdhedden (Deacon)
on Oct 06, 2006 at 14:02 UTC ( [id://576672]=note: print w/replies, xml ) Need Help??


in reply to Re: [RFC] Stringifying a thread
in thread [RFC] Stringifying a thread

'==' is alreadly overloaded for threads, therefore overload.pm is already loaded. As a result, adding ""-overloading doesn't cost anything extra.

As to performance, my tests show that overloading only costs a few percent. However, generating a 'default' string from an object (e.g. 'threads=SCALAR(0xABCDABCD)') is HUGELY expensive. Therefore, I found that for ops like "... $thr ..." and $hash{$thr} there is a greater than 500% speed improvement overall with ""-overloading.

However, while the performance increase is really nice, I like the usabily aspects more.


Remember: There's always one more bug.

Replies are listed 'Best First'.
Re^3: [RFC] Stringifying a thread
by BrowserUk (Patriarch) on Oct 06, 2006 at 15:02 UTC

    It's not like most of the calls in threads are generally high frequency calls.

    create and async have to spawn a new interpreter and clone god know's what.join has to wait for a thread to finish and an interpreter to be cleaned up. Not much else is performance criticla either.

    Even in the 'spawn and discard' model of server application, there are at least two IO operations which would totally swamp any overload overhead.

    If the overloading had a detrimental affect upon some of the calls in threads::shared, like lock or cond_signal, that might be noteworthy, but presumably that is not the case?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: [RFC] Stringifying a thread
by ysth (Canon) on Oct 06, 2006 at 17:24 UTC
    '==' is alreadly overloaded for threads, therefore overload.pm is already loaded. As a result, adding ""-overloading doesn't cost anything extra.
    Then you can disregard everything I said, except that you may want to switch to using the XS OVERLOAD: keyword.
      The XS OVERLOAD: keyword is not applicable here because the consensus is to make the overloading optional. Therefore, it must be done in the 'import' method in threads.pm. Thanks for the suggestion though.

      Remember: There's always one more bug.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-18 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found