|
Posted by Ben Ramsey on 10/20/68 11:24
Frans Fierens wrote:
> I've noticed that php cli scripts using for-loops with some if...then's
> are very slow using the php cli (command line interface). The following
> php script takes somewhat 100 seconds (php v5.0.3 on a redhat linux, 3
> Ghz PC). The same program in c (see below) less than 1 second ... I know
> that php is a scripting language, but isn't the difference between de c
> compiled prog and de php script not very extreme ?
The difference in the code isn't extreme, but the difference in the way
it's processed is.
C is compiled down to machine code and then executed at a later time.
When you execute it, you are executing the compiled code that the
machine natively understands.
PHP, on the otherhand, is not compiled and has to be interpreted by the
PHP engine each time it is run. This is, naturally, going to make it
slower than C.
--
Ben Ramsey
http://benramsey.com/
[Back to original message]
|