in reply to Which is the best compiler
As Corion pointed out, Perl is an interpreted language. When you run a Perl script, it goes through a "compilation" stage, but that only takes it to a stage that is easier for the interpreter to deal with. And all this is contained within the single perl executable. There are much more recent versions of Perl available. ActiveState currently is dispensing version 5.8.6.
If your problem is startup time, you could convert your script to something that is "always on", just waiting (blocking) for input. Or if we're talking about CGI, you could switch over to mod_perl, which eliminates the startup cost of your script.
If your problem is runtime speed, profile to find the bottlenecks, and then rework the key segments of code that are slowing you down. You may find that the script is IO bound rather than CPU bound. Or you may find that there's a really poorly written algorithm somewhere that is taking O(n^2) (or worse) time. If you can rework a key algorithm from O(n^2) time to O(n log n), you gain a magnitude of better time efficiency. Convert O(n log n) to O(n), to O(log n), to O(1), and each time you realize a dramatic improvement in runtime speed. Maybe there's a situation where you should be using a hash instead of grepping a list, etc. But definately profile before optimizing so you'll know where to focus your efforts, and which small fish to let go.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Which is the best compiler
by agynr (Acolyte) on Jan 18, 2005 at 10:57 UTC | |
by Anonymous Monk on Jan 18, 2005 at 16:32 UTC |