PHP optimization tricks
Here’s an article I came accross with some interesting PHP optimization tricks. I found the last one, about faster array access, particularly interesting/surprising.
Here’s an article I came accross with some interesting PHP optimization tricks. I found the last one, about faster array access, particularly interesting/surprising.
My favorite trick is to use perl instead – seriously, I’m currently looking for a really cheap place to host the spamgourmet bbs, because I’m afraid to install PHP on the new server. A little tricky, because the really cheap ones (like godaddy) seem to want to hardcode the host name to start with www (instead of bbs, like I’d like)
Posted by josh on 12 August 2006 @ 2pm
ha! you josh, are a perl brat.
are you afraid to install it on the new server because of performance, or security?
Posted by John on 12 August 2006 @ 3pm
Careful with the in_array / isset swap. I just tried it out on some of my code and found that isset did not correctly work like how in_array does. I couldn’t find the problem in the PHP docs. Just make sure to test it 1st.
Even if it worked, however, I’m torn about writing speed-tuned code. PHP should really take care of this for me. Same thing with most of the speed tricks.
APART from all that, however, if I was really hell-bent on speed, I wouldn’t be using these nice OO designs and abstraction layers. If I need speed, it’s less cost-effective to tune my apps (potentially lowering readability and perhaps breaking later if the assumptions about the language internals are no longer valid) than just hosting on a faster setup.
I’m hungry.
Posted by Jeff on 16 August 2006 @ 11am
Good article, I learnt a couple of things. The isset / in_array trick works very well, however you have to keep in mind one uses keys and the other values.
Posted by sanjuro on 5 March 2008 @ 6pm
© JJB Blog. Powered by WordPress using the DePo Skinny Theme.
4 Comments