You are here

function _coder_performance_increment_warning in Coder 5

1 string reference to '_coder_performance_increment_warning'
coder_performance_reviews in includes/coder_performance.inc
@file This include file implements coder functionality for Performance

File

includes/coder_performance.inc, line 83
This include file implements coder functionality for Performance

Code

function _coder_performance_increment_warning() {
  return array(
    '#warning' => t('<code class="good">++ $i</code> is faster than <code class="bad">$i ++</code>'),
    '#description' => t('When incrementing or decrementing the value of the variable <code>$i++</code> happens to be a tad slower than <code>++$i</code>. This is something PHP specific and does not apply to other languages, so don\'t go modifying your C or Java code thinking it\'ll suddenly become faster, it won\'t. <code>++$i</code> happens to be faster in PHP because instead of 4 opcodes used for <code>$i++</code> you only need 3. Post incrementation actually causes in the creation of a temporary var that is then incremented. While pre-incrementation increases the original value directly. This is one of the optimization that opcode optimized like Zend\'s PHP optimizer. It is a still a good idea to keep in mind since not all opcode optimizers perform this optimization and there are plenty of ISPs and servers running without an opcode optimizer.'),
  );
}