From abca91e0fa7045b6a5954539858a3b100a813e49 Mon Sep 17 00:00:00 2001 From: Bert Maher Date: Thu, 18 Jul 2013 17:31:58 -0700 Subject: [PATCH] Exit early during checkInvariants rather than do the O(N) loop. This loop is useful for debugging arrays but is too slow for general use, so we'll just "return true" before it and leave it in place for offline use. --- hphp/runtime/base/hphp_array.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hphp/runtime/base/hphp_array.cpp b/hphp/runtime/base/hphp_array.cpp index fe31a8a02..fccdc9929 100644 --- a/hphp/runtime/base/hphp_array.cpp +++ b/hphp/runtime/base/hphp_array.cpp @@ -323,6 +323,9 @@ bool HphpArray::checkInvariants() const { assert(m_hash); assert(m_hLoad >= m_size); size_t load = 0; + return true; + // The following loop is for debugging arrays only; it slows + // things down too much for general use for (size_t i = 0; i <= m_tableMask; i++) { load += m_hash[i] != ElmIndEmpty; }