[pypy-svn] r11970 - pypy/dist/goal

arigo at codespeak.net arigo at codespeak.net
Thu May 5 18:13:03 CEST 2005


Author: arigo
Date: Thu May  5 18:13:03 2005
New Revision: 11970

Modified:
   pypy/dist/goal/translate_pypy.py
Log:
A dumb list.sort() is much faster than heapq on 2.3.


Modified: pypy/dist/goal/translate_pypy.py
==============================================================================
--- pypy/dist/goal/translate_pypy.py	(original)
+++ pypy/dist/goal/translate_pypy.py	Thu May  5 18:13:03 2005
@@ -159,16 +159,14 @@
     options['-text'] = True
 
 def worstblocks_topten(ann, n=10):
-    import heapq
-    h = [(-count, block) for block, count in ann.reflowcounter.iteritems()]
-    heapq.heapify(h)
+    h = [(count, block) for block, count in ann.reflowcounter.iteritems()]
+    h.sort()
     print
     ansi_print(',-----------------------  Top %d Most Reflown Blocks  -----------------------.' % n, 36)
     for i in range(n):
         if not h:
             break
-        count, block = heapq.heappop(h)
-        count = -count
+        count, block = h.pop()
         ansi_print('                                                      #%3d: reflown %d times  |' % (i+1, count), 36)
         about(block)
     ansi_print("`----------------------------------------------------------------------------'", 36)



More information about the Pypy-commit mailing list