Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

RE: RE (tilly) 6: Load Balancing fun..

by dchetlin (Friar)
on Oct 03, 2000 at 03:02 UTC ( [id://35008]=note: print w/replies, xml ) Need Help??


in reply to RE (tilly) 6: Load Balancing fun..
in thread Load Balancing fun..

For the most part (as usual) I agree with tilly here. wantarray is generally the best way to do things, that gives you ultimate flexibility. And there are definitely times when returning a list instead of a hashref is good.

However, I have three minor quibbles.

  • I'm not convinced by the argument that dereferencing can eventually add up to be costly enough. Use aliasing, and you really get the best of both worlds.

    sub f { %hash = (1,2,3,4); return \%hash } *my_hash = f(); $my_hash{1}++;

    No dereffing necessary, you have the speed of passing a reference combined with the speed of direct hash access.

  • Refcounting is garbage collection. It may do some things suboptimally, but it's no less garbage collection than mark-and-sweep, etc.
  • Perl is not an interpreted language.

-dlc (sans acidic tone ;-) )

Replies are listed 'Best First'.
RE (tilly) 8 (quibbles): Load Balancing fun..
by tilly (Archbishop) on Oct 03, 2000 at 03:32 UTC
    But you can only use aliasing like that if you use a global variable. Of course in 5.6 you could immediately turn around with our and make it lexical, but accessing lexicals is faster than globals. (Of course we are quibbling at speed at this point, I believe the hash lookups are slower than either by a good margin.)

    As for refcounting being garbage collection, yes. But there is no real garbage collector per se.

    And interpreted language is somewhat semantic. Certainly you don't compile binaries. Certainly you don't interpret sourcecode directly. But the opcodes are run through an interpreter, and that causes a lot of overhead. And there is this nice thing called "eval" which is associated with interpreted langauges...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-03-29 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found