The document discusses various ways to optimize PHP performance. It provides examples of optimizing a SwiftMailer implementation by reducing function calls, using built-in array functions like array_merge instead of multiple calls, and iterating over arrays in tight loops. It also discusses how the Zend engine stores and handles values and memory management techniques like using copy-on-write to avoid wasting memory. Other optimization techniques mentioned include using opcode caching, data caching, batch database access, and creating PHP extensions.
17. Don't try to outsmart ZE Working by reference will usually make you waste memory as it can trigger more easily the copy on write < ?php $a = 1 ; /* Zval {val:1; ref_count:1; is_ref:f} */ $b = & $a ; /* Zval {val:1; ref_count:2; is_ref: t } */ print ( $b ); /* This is a pass by value function, so, * what's send to print is : * Zval2 {val:1 ref_count:1; is_ref:f } */