[pypy-svn] r36158 - pypy/dist/pypy/interpreter

xoraxax at codespeak.net xoraxax at codespeak.net
Thu Jan 4 20:35:52 CET 2007


Author: xoraxax
Date: Thu Jan  4 20:35:50 2007
New Revision: 36158

Modified:
   pypy/dist/pypy/interpreter/baseobjspace.py
Log:
Speed up the exception matching even more. Compared to the last
rev, only two micro benches are slower, in total they are still
faster than before Micheal's rewrite. The fastest ones:

 0.37x slower on test_dict.test_dict_setitem1()
 0.62x slower on test_dict.test_dict_instance_setattr_instance_dict()
 0.64x slower on test_dict.test_dict_instance_setnewattr_instance_dict()
 0.67x slower on test_bltn.test_call_sin()
 0.76x slower on test_dict.test_dict_raw_range()



Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py	Thu Jan  4 20:35:50 2007
@@ -550,15 +550,17 @@
 
     def exception_match(self, w_exc_type, w_check_class):
         """Checks if the given exception type matches 'w_check_class'."""
+	if self.is_w(w_exc_type, w_check_class):
+	    return True
+	if self.is_true(self.abstract_issubclass(w_exc_type, w_check_class)):
+	    return True
+
         if self.is_true(self.isinstance(w_check_class, self.w_tuple)):
             exclst_w = self.unpacktuple(w_check_class)
             for w_e in exclst_w:
                 if self.exception_match(w_exc_type, w_e):
                     return True
-            return False
-        if self.is_true(self.abstract_issubclass(w_exc_type, w_check_class)):
-            return True
-        return self.is_w(w_exc_type, w_check_class)
+        return False
 
     def call(self, w_callable, w_args, w_kwds=None):
         args = Arguments.frompacked(self, w_args, w_kwds)



More information about the Pypy-commit mailing list