Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Teach him a lesson with facts

by Anonymous Monk
on Feb 22, 2003 at 18:10 UTC ( [id://237777]=note: print w/replies, xml ) Need Help??


in reply to Re: Teach him a lesson with facts
in thread Teach him a lesson with facts

So I was right about that testing.

Now for whether that testing is meaningful. I tell what, it is meaningful. My purpose is not to show you that Perl cannot do ++ quick. What's wrong with perl is that it cannot do loop quick, as the first reply to your post agreed.

This is something serious, loop is something you used everywhether in your real program, not a testing case made up by me.

This is just a tip of the iceburger. I don't want argue about this any more. If you say this is the only performance issue in Perl, it is fine with me.

Replies are listed 'Best First'.
Re: Re: Re: Teach him a lesson with facts
by hardburn (Abbot) on Feb 22, 2003 at 20:23 UTC

    I think you're misunderstanding how optimization works. Take the code posted above:

    for (0..1_000_000) { $x=$_+1; }

    Or in C or Java:

    int i, x; for(i = 0; i < 1000000; i++) { x = i + 1; }

    C and Java optimizers can turn the above into this:

    int x = 1000000;

    Thus totally eliminating the loop. Run your C compiler with -O0, and you'll get comparible performance to the Perl version.

    Why isn't this test relevent? Because the C/Java optimizer cannot always unroll loops. This is fairly common in any real-world program.

    ----
    Reinvent a rounder wheel.

    Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-25 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found