in reply to compiling perl scripts aka why is perl not as fast as C
why is it that I can't compile it and get the same level of speed that a native C program would get?Because compiling still doesn't give you the speed C gives. Take for instance strings. In C, strings are just pointers to arrays with numbers. You cannot, in a single operation, add to a string. And it's even a lot harder to have all other references to such a string see the change.
In Perl, this is a lot easier. I can easily add to a string. If there's a reference to the string I'm modifying, the reference will see the change. All this makes that Perl is a lot slower than C - it's all the goodies that Perl gives to the programmer that makes it slower, that has a much bigger impact that the difference between compiled and not-compiled.
If you need speed, by all means, use C. If you are willing to sacrifice speed for programmer niceties, you have the option to use Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: compiling perl scripts aka why is perl not as fast as C
by nikosv (Deacon) on Mar 22, 2010 at 09:51 UTC | |
|
Re^2: compiling perl scripts aka why is perl not as fast as C
by Anonymous Monk on Aug 22, 2012 at 15:13 UTC |