DEV Community

Discussion on: In response to "Yes, PHP Is Faster Than C#"

Collapse
 
goaty92 profile image
goaty92

My main point is not as much to "counter" as to point out how easy it is to misunderstand performance characteristics of programs 🙂 . In fact I believe the PHP code could be further optimized to be much faster as well.

Collapse
 
jacekandrzejewski profile image
Jacek Andrzejewski

That's true, one thing is while and for loops in PHP are painfully slow compared to foreach. If you use foreach for checking characters you can also forget about strlen too.
One other minor thing you could do is to import all builtin functions you are using or prefix them with namespace (in case of builtins it's "\").

Overall I agree, benchmarks like this make no sense if you don't go extremely in depth to make sure you are really testing the same thing.