Micro-optimisation
A micro-optimisation is a piece of code that performs better than another, yet brings only a small gain of performance.
Micro-optimisation should be done only for highly constrained systems, or applications that deliver a high number of hits in short times: usually, it takes one to ten million usages for the gain to be visible.
Yet, micro-optimisations may be valuable in the long run, or as a good practice.
It is often pointless to discuss the micro-optimisation. It is a do or don’t, and should raise a consensus, or be left alone.
<?php
// this is faster than calling 3 times echo
echo 1, 2, 3;
// This is slower, yet it doesn't speed up the process a lot
echo 1;
echo 2;
echo 3;
?>
See Also
- Stop Using These 5 Outdated Optimization Tricks in PHP
- What are compiler optimized internal PHP functions and should you import them via use statement?
- Data-Driven PHP 7 Performance Optimization Methods