Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: (tye)Re: Benchmarking the basic operations

by coreolyn (Parson)
on Jan 30, 2001 at 20:23 UTC ( #55258=note: print w/replies, xml ) Need Help??

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

You said,"

    Comparing the speed of lt, gt, ge, le, ne, and eq is just, well, silly. The difference comes down to a fraction of a machine language instruction. The time it takes to dispatch a single Perl opcode dwarfs that like a flea on an aircraft carrier. "

How do you define dispatch and opcode? Apparently I'm not even literate in what constructs to focus on when optimizing, or how to isolate dispatch in a benchmark.


  • Comment on Re: (tye)Re: Benchmarking the basic operations

Replies are listed 'Best First'.
(tye)Re2: Benchmarking the basic operations
by tye (Sage) on Jan 30, 2001 at 20:55 UTC

    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 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 is a good way to figure out how much faster something is. And it can be fun and/or interesting to compare things with 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")

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://55258]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2018-01-19 12:40 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (218 votes). Check out past polls.