From 63dddacba7d9f4c5ba797f67789c02a5ef4e9260 Mon Sep 17 00:00:00 2001 From: Silbinary Wolf Date: Sat, 5 Dec 2015 19:39:37 +1100 Subject: [PATCH] Optimization: Swapped is_array for faster casting compare, shaved ~4s off flushing on 3.2ghz i5 dual core system --- core/manifest/ConfigStaticManifest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/manifest/ConfigStaticManifest.php b/core/manifest/ConfigStaticManifest.php index ba488a5b7..63787d3b9 100644 --- a/core/manifest/ConfigStaticManifest.php +++ b/core/manifest/ConfigStaticManifest.php @@ -239,7 +239,7 @@ class SS_ConfigStaticManifest_Parser { $depth = 0; $namespace = null; $class = null; $clsdepth = null; $access = 0; while($token = $this->next()) { - $type = is_array($token) ? $token[0] : $token; + $type = ($token === (array)$token) ? $token[0] : $token; if($type == T_CLASS) { $next = $this->nextString(); @@ -302,7 +302,7 @@ class SS_ConfigStaticManifest_Parser { $value = ''; while($token = $this->next()) { - $type = is_array($token) ? $token[0] : $token; + $type = ($token === (array)$token) ? $token[0] : $token; if($type == T_PUBLIC || $type == T_PRIVATE || $type == T_PROTECTED) { $access = $type; @@ -328,8 +328,8 @@ class SS_ConfigStaticManifest_Parser { if($token == '=') { $depth = 0; - while($token = $this->next(false)){ - $type = is_array($token) ? $token[0] : $token; + while($token = ($this->pos >= $this->length) ? null : $this->tokens[$this->pos++]) { + $type = ($token === (array)$token) ? $token[0] : $token; // Track array nesting depth if($type == T_ARRAY || $type == '[') { @@ -351,7 +351,7 @@ class SS_ConfigStaticManifest_Parser { $value .= $class; } else { - $value .= is_array($token) ? $token[1] : $token; + $value .= ($token === (array)$token) ? $token[1] : $token; } } }