Datesfat Chicks
5/20/2011 6:09:00 PM
On Fri, 20 May 2011 00:50:24 -0700 (PDT), lovecreatesbeauty
<lovecreatesbeauty@gmail.com> wrote:
>On French genius' TCC page: TCC can also be used to make C scripts,
>i.e. pieces of C source that you run as a Perl or Python script.
>Compilation is so fast that your script will be as fast as if it was
>an executable.
>
>I'll try TCC and use C to replace PHP for web scripting, and Perl for
>shell script. No need to bear with all the strange, unneeded and
>different syntaxes in Php and Perl. What do you see?
Won't work.
First, it can't be as fast as C if there is a compilation phase
whenever the script is invoked. That is an inherent contradiction.
Second, it ain't quite the right tool for the job; and C exists as a
possibility for web scripting, anyway.
PHP/Perl/Python have these advantages:
a)They are efficient for what they are. In some cases, the bytecoding
is an explicit option as a substitute for compilation (Python) and in
other cases it has to be done every time the script is invoked (PHP).
But these scripting languages are brutally fast. Much of the
advantage comes from the fact that the high-frequency iterations
(string searching, etc.) is "compiled in", as there are built-in
functions in the scripting language. So, the things that are done
dozens, hundreds, or perhaps thousands of times are done in the
scripting language, but the things that are done tens of thousands of
times or millions of times are done in compiled code. These languages
are fast.
Additionally, languages like PHP allow you to link in compiled
libraries if efficiency is a concern. So, imagine I'd like to erect a
web page that calculates prime factors or generates cryptographic
keys. I can add in compiled modules that do this efficiently.
b)Second, these languages protect the programmer from C-like errors.
When I make a boo-boo in PHP, I might get an error displayed as part
of the HTML content and/or an error in the logs. These are much
easier things to diagnose than a memory protection fault, for example.
c)Third, it is so convenient to make a one-line change in a PHP script
somewhere and not have to re-build anything. I can just change
dynamic web content directly with a text editor.
d)Fourth, C is ALREADY available as a CGI-BIN language. You can write
CGI-BIN handlers for Apache and so on.
I don't see the purported advantage.
DFC