[pypy-svn] r35784 - pypy/dist/pypy/translator/cli

antocuni at codespeak.net antocuni at codespeak.net
Fri Dec 15 11:57:14 CET 2006


Author: antocuni
Date: Fri Dec 15 11:57:13 2006
New Revision: 35784

Modified:
   pypy/dist/pypy/translator/cli/function.py
Log:
This heuristic makes much more sense. Thanks arigo.



Modified: pypy/dist/pypy/translator/cli/function.py
==============================================================================
--- pypy/dist/pypy/translator/cli/function.py	(original)
+++ pypy/dist/pypy/translator/cli/function.py	Fri Dec 15 11:57:13 2006
@@ -231,7 +231,7 @@
             max_case = max(cases.keys())
         except ValueError:
             max_case = 0
-        if max_case > 4096: # XXX: how to find a good way to determine whether to use switch?
+        if max_case > 3*len(cases) + 10: # the switch is very sparse, better to use the naive version
             naive = True
 
         if naive:



More information about the Pypy-commit mailing list