[Piglit] [PATCH 7/7] framework/status.py: Add early return to status_lookup

Dylan Baker baker.dylan.c at gmail.com
Wed Sep 2 14:18:26 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 51a7e21..28f8bfa 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.1



More information about the Piglit mailing list