[pypy-svn] pypy jit-unroll-loops: Not too important: for performance, test "isinstance(x, argtype)" first.

arigo commits-noreply at bitbucket.org
Mon Jan 3 18:36:47 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: jit-unroll-loops
Changeset: r40342:4e1d86ed50ab
Date: 2011-01-03 18:16 +0100
http://bitbucket.org/pypy/pypy/changeset/4e1d86ed50ab/

Log:	Not too important: for performance, test "isinstance(x, argtype)"
	first.

diff --git a/pypy/rpython/lltypesystem/opimpl.py b/pypy/rpython/lltypesystem/opimpl.py
--- a/pypy/rpython/lltypesystem/opimpl.py
+++ b/pypy/rpython/lltypesystem/opimpl.py
@@ -76,13 +76,13 @@
                 return adjust_result(func(x))
         else:
             def op_function(x, y):
-                if not (isinstance(x, AddressAsInt) and argtype is int):
-                    if not isinstance(x, argtype):
-                        raise TypeError("%r arg 1 must be %s, got %r instead" % (
+                if not isinstance(x, argtype):
+                    if not (isinstance(x, AddressAsInt) and argtype is int):
+                        raise TypeError("%r arg 1 must be %s, got %r instead"% (
                             fullopname, typname, type(x).__name__))
-                if not (isinstance(y, AddressAsInt) and argtype is int):
-                    if not isinstance(y, argtype):
-                        raise TypeError("%r arg 2 must be %s, got %r instead" % (
+                if not isinstance(y, argtype):
+                    if not (isinstance(y, AddressAsInt) and argtype is int):
+                        raise TypeError("%r arg 2 must be %s, got %r instead"% (
                             fullopname, typname, type(y).__name__))
                 return adjust_result(func(x, y))
 


More information about the Pypy-commit mailing list