chiefprogramer@gmail.com wrote:[color=blue]
> "f();" cost 1148 ns
> "fffffffffff();" cost 1273 ns (1 function char cost 13 ns)[/color]
Hey! That example rather measures the speed of the parser. Do you really
think that if you run 10 times through the same code that php will be so
stupid to parse it 10 times? Go bussin!
Jerry Stuckle wrote:
[color=blue]
> If speed is your primary concern, don't use an interpretive language
> like PHP.[/color]
There are several optimizers for php. I believe Zend has one with a JIT
compiler. I remember reading an article on JIT compilers with Java that
explained that to get the slightly better performance with C++ for real
life applications they needed quite some compiler tuning. With common
compile options the JITters automatic dynamic optimizations beated C++
by a streatlength. Now those Java people say that Java can be better
optimized then weakly typed languages like php, but i have seen JITted
Smalltalk code run just as fast. I guess it is really a matter of what
your application should do, how much time you can spend on building it
and how much time you can spend (i.e. have left) on optimizing it.
If there is a lot of abstraction and logic, OOP is often a good choice.
With one of those large cluster servers that are nowadays available
php's lack of (native) multithreading is probably more of an argument
then its raw execution speed.
Greetings,
Henk Verhoeven,
www.metaclass.nl.