i have coded a site in Procedural style in PHP, now to improve performance i need to compile them. I dont hav a good idea on PHP code compilation ! so need some help on how to do it for Procedural style code !
4
-
2Are you sure compilation is the best option for performance improvement? Have you profiled and found that there are no other code changes? Compiling is typically a much later step in optimization.Tesserex– Tesserex2011-04-04 02:33:03 +00:00Commented Apr 4, 2011 at 2:33
-
@Tesserex can you tell me the steps to improve performance ! i have done changes to the script from steps i found googlingSourav– Sourav2011-04-04 02:39:28 +00:00Commented Apr 4, 2011 at 2:39
-
Most Google steps are useless. They tell you things like what type of loop to use, pre-increment vs post, single vs double quotes, etc. Those all give absolutely tiny gains, if anything. Good optimization requires understanding running time analysis of your algorithms (big O mainly.) Find what code sections are taking most of your execution time, and post them here, so we can give you more concrete advice.Tesserex– Tesserex2011-04-04 03:18:11 +00:00Commented Apr 4, 2011 at 3:18
-
@Tesserex thnx for the advice :)Sourav– Sourav2011-04-04 03:19:23 +00:00Commented Apr 4, 2011 at 3:19
Add a comment
|
1 Answer
PHP is not a traditionally compiled language. There's the Facebook HipHop PHP C++ compiler/transformer, but you should have very specific reasons before you start using it. The usual way to speed up PHP scripts beyond what can be done by internal optimization is by using opcode caching on the executing server.
2 Comments
Sourav
what is internal optimization ? can you tell me a little bit more ?
deceze
@Sourav Make the script work as well as possible. Don't do stupid, time wasting operations. Use data caching if appropriate, etc. etc. Do whatever you need to do in the most efficient manner possible. Then micro-optimize your code. Only if it's still too slow after doing all that, worry about compilation.