Do you know where your variables are? | |
PerlMonks |
"Get the Job Done" (GeJDo)by dragonchild (Archbishop) |
on Sep 19, 2001 at 16:38 UTC ( [id://113303]=note: print w/replies, xml ) | Need Help?? |
The issue of "best" is very deceptive. Best how? I've said this in a number of nodes, but I'm going to say it here all laid out.
The best language when it comes to CPU and RAM usage is machine language. You cannot do better than machine language. At all. No way. The best compiler will only match the machine language implementation, and usually not even come close. However, development time in machine language is extremely slow. Like, slower than that. And, maintenance is even harder. This is why we use higher-generation languages. Now, every 3+G language has tradeoffs. Each language's syntax lends itself to certain applications. FORTRAN is excellent for engineering/math. COBOL is excellent for business apps. Haskell for functional, etc. In addition, different compilers do different things well. You can compile the same C program with two compilers and one will have better RAM, but worse CPU. The other will be reversed. Perl, that 4G language we all know and love, has been optimized for development time. Now, what does that mean? It means that no matter how I think about it, I can get a functional program that does what I want it to do in a reasonable amount of time.
Does this mean that Perl cannot do all the things other languages do? Yes, it can ... and "Well Enough". Perl is, as we all know, a RAM hog. It can also be a CPU hog. This is part of the tradeoff for having lightning-fast development time. Now, what does this all mean? It means that "Good Enough" should be your mantra. You can always optimize. You can always rewrite your thing in machine code, if you really wanted to. However, you have to determine when the gains made in runtime performance are not worth the value of the (re)development time needed to achieve those gains. At that point, you have hit diminishing returns, and should probably stop. If your program works, it doesn't matter if the template is perfect or if your for-loops are optimized or whatever. Are you going to reuse the template? If not, then leave it alone. If you are and the rewrite would help you when you use it again, then go ahead and rewrite it. Otherwise, leave it alone. ------ Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
In Section
Meditations
|
|