Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

(tye)Re2: Benchmarking the basic operations

by tye (Sage)
on Jan 30, 2001 at 20:55 UTC ( [id://55264]=note: print w/replies, xml ) Need Help??


in reply to Re: (tye)Re: Benchmarking the basic operations
in thread Benchmarking the basic operations

Sorry, those aren't my terms. :) Dispatching opcodes is a description I've heard of how Perl executes the code that it has compiled. So Perl has a fairly high overhead per opcode.

The constructs to focus on when optimizing are the contructs that take the big chunk of the time. And usually the only big win you have when optimizing is to change the algorithm, that is, change the whole way you do things. Tweaking tiny things here and there is usually a waste of your time.

Now occasionally you can do something simple like change a s/\W+//g to tr/a-zA-Z0-9_//cd and get a big speed improvement IF you are doing that operation on a huge number of really long strings.

Another way to look at is, if you need to use Benchmark.pm in order figure out which of two ways is faster, then it probably isn't worth your time to be worrying about that "optimization". Using Benchmark.pm is a good way to figure out how much faster something is. And it can be fun and/or interesting to compare things with Benchmark.pm. But if you don't have a real problem that runs noticeably faster after your change, then the change really didn't make much difference.

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re2: Benchmarking the basic operations

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found