[pypy-svn] r17672 - pypy/dist/pypy/rpython

pedronis at codespeak.net pedronis at codespeak.net
Mon Sep 19 21:19:09 CEST 2005


Author: pedronis
Date: Mon Sep 19 21:19:08 2005
New Revision: 17672

Modified:
   pypy/dist/pypy/rpython/rlist.py
Log:
avoid zeroing twice in alloc_and_set



Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py	(original)
+++ pypy/dist/pypy/rpython/rlist.py	Mon Sep 19 21:19:08 2005
@@ -811,10 +811,11 @@
     l = malloc(LISTPTR.TO)
     l.length = count
     l.items = malloc(LISTPTR.TO.items.TO, count)
-    i = 0
-    while i < count:
-        l.items[i] = item
-        i += 1
+    if item: # as long as malloc it is known to zero the allocated memory avoid zeroing twice
+        i = 0
+        while i < count:
+            l.items[i] = item
+            i += 1
     return l
 
 def rtype_alloc_and_set(hop):



More information about the Pypy-commit mailing list