[pypy-svn] r75776 - pypy/branch/interplevel-array/pypy/jit/tl

hakanardo at codespeak.net hakanardo at codespeak.net
Fri Jul 2 17:29:49 CEST 2010


Author: hakanardo
Date: Fri Jul  2 17:29:47 2010
New Revision: 75776

Modified:
   pypy/branch/interplevel-array/pypy/jit/tl/pypyjit_demo.py
Log:
testcode

Modified: pypy/branch/interplevel-array/pypy/jit/tl/pypyjit_demo.py
==============================================================================
--- pypy/branch/interplevel-array/pypy/jit/tl/pypyjit_demo.py	(original)
+++ pypy/branch/interplevel-array/pypy/jit/tl/pypyjit_demo.py	Fri Jul  2 17:29:47 2010
@@ -1,38 +1,48 @@
-base = object
+## base = object
 
-class Number(base):
-    __slots__ = ('val', )
-    def __init__(self, val=0):
-        self.val = val
-
-    def __add__(self, other):
-        if not isinstance(other, int):
-            other = other.val
-        return Number(val=self.val + other)
+## class Number(base):
+##     __slots__ = ('val', )
+##     def __init__(self, val=0):
+##         self.val = val
+
+##     def __add__(self, other):
+##         if not isinstance(other, int):
+##             other = other.val
+##         return Number(val=self.val + other)
             
-    def __cmp__(self, other):
-        val = self.val
-        if not isinstance(other, int):
-            other = other.val
-        return cmp(val, other)
-
-    def __nonzero__(self):
-        return bool(self.val)
-
-def g(x, inc=2):
-    return x + inc
-
-def f(n, x, inc):
-    while x < n:
-        x = g(x, inc=1)
-    return x
-
-import time
-#t1 = time.time()
-#f(10000000, Number(), 1)
-#t2 = time.time()
-#print t2 - t1
-t1 = time.time()
-f(10000000, 0, 1)
-t2 = time.time()
-print t2 - t1
+##     def __cmp__(self, other):
+##         val = self.val
+##         if not isinstance(other, int):
+##             other = other.val
+##         return cmp(val, other)
+
+##     def __nonzero__(self):
+##         return bool(self.val)
+
+## def g(x, inc=2):
+##     return x + inc
+
+## def f(n, x, inc):
+##     while x < n:
+##         x = g(x, inc=1)
+##     return x
+
+## import time
+## #t1 = time.time()
+## #f(10000000, Number(), 1)
+## #t2 = time.time()
+## #print t2 - t1
+## t1 = time.time()
+## f(10000000, 0, 1)
+## t2 = time.time()
+## print t2 - t1
+
+from array import array
+img=array(4)
+def f():
+    sa=0
+    for i in xrange(4):
+        sa+=img[i]
+    return sa
+
+print f()



More information about the Pypy-commit mailing list