[pypy-svn] r31147 - in pypy/dist/pypy: config objspace/std

mwh at codespeak.net mwh at codespeak.net
Tue Aug 8 00:33:44 CEST 2006


Author: mwh
Date: Tue Aug  8 00:33:41 2006
New Revision: 31147

Added:
   pypy/dist/pypy/objspace/std/dictmultiobject.py
      - copied, changed from r30977, pypy/dist/pypy/objspace/std/dictobject.py
Modified:
   pypy/dist/pypy/config/pypyoption.py
   pypy/dist/pypy/objspace/std/model.py
   pypy/dist/pypy/objspace/std/objspace.py
Log:
yet another kind of dictionary, this one designed to allow many different
internal implementations.  translatable, and seems to be somehow slightly
faster than the default, which is surprising but i'll take it :-)


Modified: pypy/dist/pypy/config/pypyoption.py
==============================================================================
--- pypy/dist/pypy/config/pypyoption.py	(original)
+++ pypy/dist/pypy/config/pypyoption.py	Tue Aug  8 00:33:41 2006
@@ -65,6 +65,10 @@
                        "use dictionaries optimized for string keys",
                        default=False),
 
+            BoolOption("withmultidict",
+                       "use dictionaries optimized for flexibility",
+                       default=False),
+
             BoolOption("oldstyle",
                        "specify whether the default metaclass should be classobj",
                        default=False),

Modified: pypy/dist/pypy/objspace/std/model.py
==============================================================================
--- pypy/dist/pypy/objspace/std/model.py	(original)
+++ pypy/dist/pypy/objspace/std/model.py	Tue Aug  8 00:33:41 2006
@@ -14,6 +14,8 @@
     "withstrjoin"    : ["strjoinobject.W_StringJoinObject"],
     "withstrdict"    : ["dictstrobject.W_DictStrObject",
                         "dictstrobject.W_DictStrIterObject"],
+    "withmultidict"  : ["dictmultiobject.W_DictMultiObject",
+                        "dictmultiobject.W_DictMultiIterObject"],
 }
 
 class StdTypeModel:
@@ -58,6 +60,7 @@
         from pypy.objspace.std import listobject
         from pypy.objspace.std import dictobject
         from pypy.objspace.std import dictstrobject
+        from pypy.objspace.std import dictmultiobject
         from pypy.objspace.std import stringobject
         from pypy.objspace.std import strsliceobject
         from pypy.objspace.std import strjoinobject

Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py	(original)
+++ pypy/dist/pypy/objspace/std/objspace.py	Tue Aug  8 00:33:41 2006
@@ -58,6 +58,9 @@
         if self.config.objspace.std.withstrdict:
             from pypy.objspace.std import dictstrobject
             self.DictObjectCls = dictstrobject.W_DictStrObject
+        elif self.config.objspace.std.withmultidict:
+            from pypy.objspace.std import dictmultiobject
+            self.DictObjectCls = dictmultiobject.W_DictMultiObject
         else:
             from pypy.objspace.std import dictobject
             self.DictObjectCls = dictobject.W_DictObject
@@ -469,7 +472,7 @@
     def finditem(self, w_obj, w_key):
         # performance shortcut to avoid creating the OperationError(KeyError)
         if type(w_obj) is self.DictObjectCls:
-            if not self.config.objspace.std.withstrdict:
+            if not self.config.objspace.std.withstrdict and not self.config.objspace.std.withmultidict:
                 return w_obj.content.get(w_key, None)
             else:
                 return w_obj.get(w_key, None)



More information about the Pypy-commit mailing list