This link has been bookmarked by 353 people . It was first bookmarked on 22 May 2006, by craig hancock.
-
15 Feb 16
-
18 May 15
-
PHP does not actually create duplicate variables when "pass by value" is used, but uses high speed reference counting internally. So in TestRef(), $b and $c take longer to set because the references have to be tracked, while in TestNoRef(), $b and $c just point to the original value of $a, and the reference counter is incremented. So TestNoRef() will execute faster than TestRef().
In contrast, functions that accept array and object parameters have a performance advantage when references are used. This is because arrays and objects do not use reference counting, so multiple copies of an array or object are created if "pass by value" is used. So the following code:
function ObjRef(&$o)
{
$a =$o->name;
}is faster than:
$function ObjRef($o)
{
$a = $o->name;
}Note: In PHP 5, all objects are passed by reference automatically, without the need of an explicit & in the parameter list. PHP 5 object performance should be significantly faster.
-
-
09 May 14
-
01 Apr 14
-
27 Dec 13
-
27 Dec 12
-
04 Jul 12
Rafael OllerMaxClients
-
23 May 12
-
15 Apr 12
-
10 Feb 12
-
08 Feb 12
-
28 Jan 12
-
05 Jan 12
-
17 Dec 11
Rob Taylorstudy once again shows us that optimizing your performance is extremely complex. It requires an understanding of multiple software subsystems including network routing, the TCP/IP stack, the amount of physical and virtual memory, the number of CPUs, the behavior of Apache child processes, your PHP scripts, and the database configuration
-
15 Dec 11
-
09 Dec 11
-
database connections
-
Accessing a hard disk can be 50 to 100 times slower than reading data from RAM.
-
if your server is purely for web serving, avoid running (or even installing) X-Windows on the machine.
-
removing include unused networking protocols, mail servers, antivirus scanners, hardware drivers for mice, infrared ports and the like.
-
The initial parent process acts like a guardian angel, making sure that all the child processes are working properly and coordinating everything.
-
Apache 2.0 offers operation in multi-threaded mode
-
The following parameters are particularly important in configuring child processes
-
require DNS lookups
-
# disable DNS lookups: PHP scripts only get the IP address
-
turn on FollowSymLinks and turn off SymLinksIfOwnerMatch to prevent additional lstat()
-
the opcodes were discarded
-
Caching: the Ultimate Speed Booster
-
Finally, the HTML sent to a web client can be compressed. This is enabled by placing the following code at the beginning of your PHP script:
-
Perhaps the most significant change to PHP performance I have experienced since I first wrote this article is my use of Squid
-
It is better to offload downloading of these static files by using Squid in httpd-accelerator mode.
-
Using Benchmarks
-
include ab (short for apachebench) which is part of the Apache release, and the newer flood (httpd.apache.org/test/flood)
-
You can monitor how your server behaves as the benchmarks are conducted on Unix using "vmstat 1"
-
"top d 1" which gives you a full screen update on all processes running sorted by CPU load every 1 second
-
I now recommend running vmstat for at least 5 seconds with "vmstat 5"
-
you can benchmark using the built-in microtime() function
-
-
05 Dec 11
-
16 Nov 11
-
13 Nov 11
-
31 Oct 11
-
19 Oct 11
-
27 Sep 11
-
15 Sep 11
-
01 Sep 11
lin11230"MinSpareServers "
-
07 Aug 11
godlovesuglyuse an opcode cache, comments are already ignored. This is a myth from PHP3 days, when each li
-
03 Jun 11
-
20 Apr 11
-
17 Apr 11
-
01 Apr 11
-
31 Mar 11
-
28 Mar 11
-
07 Mar 11
-
07 Dec 10
-
29 Nov 10
-
03 Nov 10
-
07 Oct 10
-
01 Oct 10
John WrightI need to study this
php reference performance optimization programming apache development howto microblog 4twitter
-
22 Sep 10
-
15 Sep 10
-
14 Sep 10
-
05 Sep 10
-
01 Sep 10
-
01 Aug 10
-
18 Jul 10
-
16 Jul 10
-
12 Jul 10
-
23 May 10
-
10 Mar 10
-
is a set of tradeoffs between speed versus accuracy versus scalability
-
ob_start("ob_gzhandler");
-
You may be surprised to find that the overhead of using Apache to serve both dynamic PHP and static images, javascript, css, html is extremely high.
-
Squid in httpd-accelerator mode
-
-
27 Feb 10
-
26 Feb 10
-
25 Feb 10
-
17 Feb 10
-
16 Feb 10
-
Bernard BoulangerIn this chapter, we explain why optimizing PHP involves many factors which are not code related, and why tuning PHP requires an understanding of how PHP performs in relation to all the other subsystems on your server, and then identifying bottlenecks caus
-
bboulanger84In this chapter, we explain why optimizing PHP involves many factors which are not code related, and why tuning PHP requires an understanding of how PHP performs in relation to all the other subsystems on your server, and then identifying bottlenecks caus
-
10 Feb 10
-
28 Jan 10
-
21 Jan 10
-
14 Jan 10
-
12 Jan 10
-
11 Jan 10
-
08 Jan 10
-
12 Dec 09
-
11 Nov 09
-
08 Nov 09
-
06 Nov 09
-
11 Oct 09
-
03 Oct 09
-
17 Aug 09
-
01 Aug 09
-
29 Jun 09
-
20 Jun 09
-
18 Jun 09
-
17 Jun 09
-
27 May 09
-
22 May 09
-
07 Apr 09
Taufan AeroperkasaSome people might forgot about this
howto programming php development performance apache reference optimization for:ruckuus for:ibnutri
-
31 Mar 09
-
25 Mar 09
-
24 Mar 09
-
26 Feb 09
-
29 Jan 09
-
26 Jan 09
-
19 Jan 09
Long Nguyen H DPHP is a very fast programming language, but there is more to optimizing PHP than just speed of code execution.
-
24 Dec 08
-
18 Dec 08
-
23 Nov 08
-
19 Nov 08
-
08 Nov 08
-
21 Oct 08
-
26 Sep 08
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.