Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to make your Perl 30% faster

by bluto (Curate)
on Nov 16, 2004 at 17:00 UTC ( [id://408167]=note: print w/replies, xml ) Need Help??


in reply to How to make your Perl 30% faster

Using this probably depends on how much risk you can live with. Personally, I've always hesitated turning on extra optimization during compiles. For example, on AIX there is a caveat in the man pages for the built-in compiler of "The -O3 specific optimizations have the potential to alter the semantics of a user's program", which doesn't give me any warm feelings.

I'm not saying gcc is subject to this since I haven't used it in a while, but the fact that they don't enable these cool features by default seems to indicate they understand there is some risk involved.

Replies are listed 'Best First'.
Re^2: How to make your Perl 30% faster
by hardburn (Abbot) on Nov 16, 2004 at 17:28 UTC

    Many of the optimizations make it hard to debug the program. Most of us don't debug the perl binary, so that's a non-issue.

    There are cases where optimization can break code. This is one good reason to have a good test suite. Usually it happens around particularly hairy code (IIRC, Duff's Device tends to trip up optimizers).

    Also, higher optimization levels may start trading off time for space, which might make someone still running Perl on an old VAX angry.

    In the general case of a regular Perl programmer, running on a reasonably up-to-date machine, higher optimization is fine.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      Usually it happens around particularly hairy code.

      Kind of like the C code that perl itself is written in? :-)

      Also, higher optimization levels may start trading off time for space, which might make someone still running Perl on an old VAX angry.

      Who is interested in an old VAX? ;-)

      But now that you mention it:
      -rwxr-xr-x    2 root root   11588 2004-11-17 09:49 /opt/perl-5.8.0_t/bin/perl
      -rwxr-xr-x    2 root root 1213952 2004-11-17 09:49 /usr/local/bin/perl
      
      Which looks really weird for me in the first case.

      Bye
       PetaMem
          All Perl:   MT, NLP, NLU

Re^2: How to make your Perl 30% faster
by PetaMem (Priest) on Nov 17, 2004 at 08:10 UTC

    The original interpreter the "autovectorized" one was compared against was also compiled with -O3 as one can see in the updated node.

    All runs stable - at least on the P4 - don't know about other architectures, but sse2 is not of much interest there - I guess. Probably Mac/PPC users could experience similar results if GCC supports the altivec engine.

    Bye
     PetaMem
        All Perl:   MT, NLP, NLU

Log In?
Username:
Password:

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

    No recent polls found