Permalink
Browse files

Running the explode instruction outside the foreach loops is faster

  • Loading branch information...
acidvertigo committed Aug 18, 2011
1 parent 3cc4f27 commit cfd6d3cd5a44bb702b787dc2db144f4246e0c001
Showing with 2 additions and 1 deletion.
  1. +2 −1 min/lib/Minify/Controller/MinApp.php
@@ -45,7 +45,8 @@ public function setupSources($options) {
$this->log("Duplicate group key found.");
return $options;
}
- foreach (explode(',', $_GET['g']) as $key) {
+ $keys = explode(',', $_GET['g']);
+ foreach ($keys as $key) {
if (! isset($cOptions['groups'][$key])) {
$this->log("A group configuration for \"{$key}\" was not found");
return $options;

5 comments on commit cfd6d3c

Thanks, but I prefer this existing code for reading and for not introducing another variable. Can I get a link that shows micro-optimization is worth it?

The links demonstrate what I already knew: there's no functional difference, but more devs might find it more readable.

The links demonstrate what I already knew: there's no functional difference, but more devs might find it more readable.

Owner

acidvertigo replied Aug 19, 2011

Please sign in to comment.