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.
In reply to Re: compiling perl scripts aka why is perl not as fast as C
by JavaFan
in thread compiling perl scripts aka why is perl not as fast as C
by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |