Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: package function calling

by halley (Prior)
on Jul 12, 2005 at 13:44 UTC ( [id://474273]=note: print w/replies, xml ) Need Help??


in reply to package function calling

(1) Don't worry about performance unless there's an obvious performance problem. Especially don't worry about the performance of little features. This is called "premature optimization."

(2) When you DO find a serious performance problem, attack the worst performance areas first. How do you know what's the worst? You Devel::Profile the code as a whole and Benchmark alternatives. Profiling and Benchmarking is the only sane way of discovering what portion of your program is taking the most time. Update: clarified myself reflecting L~R's corrections.

(3) The specific feature you mention should have almost no effect on execution time, since the function name is entered into both symbol tables. The only difference I would guess would be how long it took the parser to parse the extra four tokens.

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re^2: package function calling
by BarMeister (Beadle) on Jul 12, 2005 at 13:50 UTC
    Ok maybe I should rephrase to ask which method is the "best practice" for doing that? I was asking just out of curiosity...since it is better to do something the right way the first time :-)
      If the symbol is imported, it's imported for a reason. This is typically for readability or convenience. Programs are usually more clear if they read smoothly without a lot of extra words and punctuation sprinkled in.

      However, if by being extra-verbose, your program gains clarity for those who are reading it, then go ahead. This can happen when more than one package might have a routine by similar names. If two packages have identical routine names, you might need to clarify the situation by specifying the package name.

      --
      [ e d @ h a l l e y . c c ]

Re^2: package function calling
by Limbic~Region (Chancellor) on Jul 12, 2005 at 13:56 UTC
    halley,
    I don't see how Benchmark is going to be a good solution in finding what the problem is. You need to profile to do that. Benchmark is designed to compare two or more functionally equivalent pieces of code not compare against itself.

    Cheers - L~R

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://474273]
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: (3)
As of 2024-03-29 06:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found