On Fri, 9 Jan 2004
wrote:
> (Yash) wrote:
>
> > I am primarily asking about whether writing a program in Perl can
> > cause significant performance impact.
>
> Yes, it can.
I'm sure your answer is precisely correct: "yes, it *can*".
You don't need this to be pointed out, but perhaps some readers would
be helped by it: I would want to ask more importantly, was it the
right question? That needs to be understood in context. There's
usually little to be gained from software that mostly gets the right
answer fast, if it also sometimes gets the wrong answer, or crashes
horribly. C is a fine weapon for those skilled in the arts of
weaponry, but it's also rather good at shooting the practitioner in
the foot.
Perl is IMHO an excellent language for developing a reliable and
resilient prototype. For many purposes, the end of the propotype
stage is the earliest stage at which considerations of code
performance are appropriate to be considered (rules 1 and 2, and
possibly 3, of optimization are "don't optimize yet").
Many of those Perl prototypes go on to be reliable and resilient
production systems coded in Perl ("don't optimize in the wrong
place"). If and when it becomes evident that the code is too slow (to
the extent that it's uneconomic to solve the problem by throwing some
more CPU at it), that's the time to consider re-implementing. The
work that was put into the prototype won't by any means have been
wasted! And at least you'll have some code to profile, so you can see
where most of the time is being spent (and I have to say that's rarely
obvious ab initio, it becomes clear only when the application has been
prototyped and is actually running).
I don't myself recall a situation where an application was ever turned
from being impractical into feasible merely by recoding in a different
language. I do, however, recall an occasion where a task that needed
3 days computation was re-examined from scratch, and a totally
different algorithm was used, bringing the time down to about 20
minutes. You're not likely to get that scale of savings by mere
choice of coding language: you've got to examine the problem at a
fundamental level.
That's my "take" on the topic, anyhow. We physicists are reputed to
code FORTRAN in any language, by the way ;-}