in reply to High Performance Perl
Perl is a highly dynamic language. A compiler can't optimize much because the programmer is allowed to change the world. Optimizations can only happen when you have guarantees. Perl 5 doesn't have much in the way of letting the programmer tell the compiler, "hey, this is an array of ints and I'll never ever put anything but ints in it" (for instance). Perl 6 has much more capability in this regard.
I'm curious though about why/where people would say that perl doesn't have great performance. Of course perl isn't going to be as fast as C for most tasks because perl is interpretted bytecode. But where Perl really wins is in programmer productivity. I don't have an online reference handy, but in the book "The Practice of Programming" Kernighan and Pike use several languages to implement the same task. A table on page 81 of that book shows the run time and number of lines of code for each language. C had the fastest runtime at .3 sec but also had the most lines of code at 150. Perl on the other hand came in second in runtime at 1 second but was only 18 lines of code. Sure, the perl code is probably denser, but I'd still be willing to bet that it took far less time to write and debug those 18 lines than it did to write and debug those 150 lines. And the actual run time for the perl implementation was fast enough and that's often what matters.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: High Performance Perl
by jonadab (Parson) on May 25, 2005 at 12:30 UTC | |
by audreyt (Hermit) on May 25, 2005 at 14:25 UTC | |
by jonadab (Parson) on May 26, 2005 at 10:54 UTC | |
by audreyt (Hermit) on May 26, 2005 at 14:35 UTC |