[Piglit] [PATCH 5/8] status.py: Add early return to status_lookup

Dylan Baker baker.dylan.c at gmail.com
Fri Aug 21 17:21:17 PDT 2015


It's rediculously expensive to send a Status through the status_lookup
factory, it's much cheaper to return early, and doesn't really affect
non Status lookups.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/status.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/framework/status.py b/framework/status.py
index 1e974a1..dbf9e22 100644
--- a/framework/status.py
+++ b/framework/status.py
@@ -80,6 +80,11 @@ def status_lookup(status):
     does not correspond to a key it will raise an exception
 
     """
+    # Don't go through this if what we've been passed already is a status, it's
+    # very expensive
+    if isinstance(status, Status):
+        return status
+
     status_dict = {
         'skip': SKIP,
         'pass': PASS,
-- 
2.5.0



More information about the Piglit mailing list