[pypy-svn] r39869 - in pypy/dist/pypy: config doc doc/config objspace/std objspace/std/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Mar 4 12:45:22 CET 2007


Author: cfbolz
Date: Sun Mar  4 12:45:20 2007
New Revision: 39869

Removed:
   pypy/dist/pypy/doc/config/objspace.std.withstrdict.txt
   pypy/dist/pypy/objspace/std/dictstrobject.py
   pypy/dist/pypy/objspace/std/test/test_dictstrobject.py
Modified:
   pypy/dist/pypy/config/pypyoption.py
   pypy/dist/pypy/doc/object-optimizations.txt
   pypy/dist/pypy/objspace/std/dicttype.py
   pypy/dist/pypy/objspace/std/marshal_impl.py
   pypy/dist/pypy/objspace/std/model.py
   pypy/dist/pypy/objspace/std/objspace.py
   pypy/dist/pypy/objspace/std/test/test_dictobject.py
   pypy/dist/pypy/objspace/std/test/test_proxy.py
Log:
trying to beat michael in the "removing code" metric:
kill the now obsolete string dicts


Modified: pypy/dist/pypy/config/pypyoption.py
==============================================================================
--- pypy/dist/pypy/config/pypyoption.py	(original)
+++ pypy/dist/pypy/config/pypyoption.py	Sun Mar  4 12:45:20 2007
@@ -136,14 +136,9 @@
                    "(the empty string and potentially single-char strings)",
                    default=False),
 
-        BoolOption("withstrdict",
-                   "use dictionaries optimized for string keys",
-                   default=False),
-
         BoolOption("withmultidict",
                    "use dictionaries optimized for flexibility",
-                   default=False,
-                   requires=[("objspace.std.withstrdict", False)]),
+                   default=False),
 
         BoolOption("withsharingdict",
                    "use dictionaries that share the keys part",

Modified: pypy/dist/pypy/doc/object-optimizations.txt
==============================================================================
--- pypy/dist/pypy/doc/object-optimizations.txt	(original)
+++ pypy/dist/pypy/doc/object-optimizations.txt	Sun Mar  4 12:45:20 2007
@@ -77,28 +77,14 @@
 Dictionary optimizations
 ========================
 
-string-keyed dictionaries
--------------------------
-
-String-keyed dictionaries are an alternate implementation of the ``dict`` type.
-These dictionaries are optimized for string keys, which is obviously a big win
-for all but the most contrived Python programs. As soon as one non-string key
-is stored in the dict
-the whole information in the string-keyed dictionary is copied over into another
-RPython-dictionary, where arbitrary Python objects can be used as keys.
-
-You can enable this feature with the :config:`objspace.std.withstrdict` option.
-
 multi-dicts
 -----------
 
-Multi-dicts are another special implementation of dictionaries. While
-implementing the string-keyed dictionaries it became clear that it is very
-useful to *change* the internal representation of an object during its lifetime.
-String-keyed dictionaries already do that in a limited way (changing the
-representation from a string-to-object mapping to an object-to-object mapping).
-Multi-Dicts are way more general: they provide generic support for such
-switching of representations for dicts.
+Multi-dicts are a special implementation of dictionaries.  It became clear that
+it is very useful to *change* the internal representation of an object during
+its lifetime.  Multi-Dicts are a general way to do that for dictionaries: they
+provide generic support for the switching of internal representations for
+dicts.
 
 If you just enable multi-dicts, special representations for empty dictionaries,
 for string-keyed dictionaries and for small dictionaries are used (as well as a

Modified: pypy/dist/pypy/objspace/std/dicttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dicttype.py	(original)
+++ pypy/dist/pypy/objspace/std/dicttype.py	Sun Mar  4 12:45:20 2007
@@ -183,11 +183,6 @@
         raise OperationError(
             space.w_RuntimeError,
             space.wrap("cannot pickle dictiters with multidicts"))
-    if space.config.objspace.std.withstrdict:
-        from pypy.objspace.std.dictstrobject import \
-            W_DictStrIter_Keys as W_DictIter_Keys, \
-            W_DictStrIter_Values as W_DictIter_Values, \
-            W_DictStrIter_Items as W_DictIter_Items
     else:
         from pypy.objspace.std.dictobject import \
             W_DictIter_Keys, W_DictIter_Values, W_DictIter_Items
@@ -204,8 +199,6 @@
         raise OperationError(space.w_TypeError, space.wrap(msg))
     w_clone.space = space
     w_clone.content = w_self.content
-    if space.config.objspace.std.withstrdict:
-        w_clone.content_str = w_self.content_str
     w_clone.len = w_self.len
     w_clone.pos = 0
     w_clone.setup_iterator()

Modified: pypy/dist/pypy/objspace/std/marshal_impl.py
==============================================================================
--- pypy/dist/pypy/objspace/std/marshal_impl.py	(original)
+++ pypy/dist/pypy/objspace/std/marshal_impl.py	Sun Mar  4 12:45:20 2007
@@ -26,7 +26,6 @@
 from pypy.objspace.std.listobject    import W_ListObject
 from pypy.objspace.std.dictobject    import W_DictObject
 from pypy.objspace.std.dictmultiobject    import W_DictMultiObject
-from pypy.objspace.std.dictstrobject import W_DictStrObject
 from pypy.objspace.std.stringobject  import W_StringObject
 from pypy.objspace.std.typeobject    import W_TypeObject
 from pypy.objspace.std.longobject    import W_LongObject
@@ -360,18 +359,6 @@
         m.put_w_obj(w_value)
     m.atom(TYPE_NULL)
 
-def marshal_w__DictStr(space, w_dict, m):
-    m.start(TYPE_DICT)
-    if w_dict.content is not None:
-        for w_key, w_value in w_dict.content.iteritems():
-            m.put_w_obj(w_key)
-            m.put_w_obj(w_value)
-    else:
-        for key, w_value in w_dict.content_str.iteritems():
-            m.put_w_obj(space.wrap(key))
-            m.put_w_obj(w_value)
-    m.atom(TYPE_NULL)
-
 def unmarshal_Dict(space, u, tc):
     # since primitive lists are not optimized and we don't know
     # the dict size in advance, use the dict's setitem instead

Modified: pypy/dist/pypy/objspace/std/model.py
==============================================================================
--- pypy/dist/pypy/objspace/std/model.py	(original)
+++ pypy/dist/pypy/objspace/std/model.py	Sun Mar  4 12:45:20 2007
@@ -12,8 +12,6 @@
     "withsmallint"   : ["smallintobject.W_SmallIntObject"],
     "withstrslice"   : ["strsliceobject.W_StringSliceObject"],
     "withstrjoin"    : ["strjoinobject.W_StringJoinObject"],
-    "withstrdict"    : ["dictstrobject.W_DictStrObject",
-                        "dictstrobject.W_DictStrIterObject"],
     "withmultidict"  : ["dictmultiobject.W_DictMultiObject",
                         "dictmultiobject.W_DictMultiIterObject"],
     "withmultilist"  : ["listmultiobject.W_ListMultiObject"],
@@ -64,7 +62,6 @@
         from pypy.objspace.std import tupleobject
         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 listmultiobject
         from pypy.objspace.std import stringobject
@@ -125,8 +122,7 @@
                     else:
                         imported_but_not_registered[implcls] = True
 
-        if (config.objspace.std.withstrdict or
-            config.objspace.std.withmultidict):
+        if config.objspace.std.withmultidict:
             del self.typeorder[dictobject.W_DictObject]
             del self.typeorder[dictobject.W_DictIterObject]
 

Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py	(original)
+++ pypy/dist/pypy/objspace/std/objspace.py	Sun Mar  4 12:45:20 2007
@@ -120,10 +120,7 @@
         self.FrameClass = StdObjSpaceFrame
 
         # XXX store the dict class on the space to access it in various places
-        if self.config.objspace.std.withstrdict:
-            from pypy.objspace.std import dictstrobject
-            self.DictObjectCls = dictstrobject.W_DictStrObject
-        elif self.config.objspace.std.withmultidict:
+        if self.config.objspace.std.withmultidict:
             from pypy.objspace.std import dictmultiobject
             self.DictObjectCls = dictmultiobject.W_DictMultiObject
             self.emptydictimpl = dictmultiobject.EmptyDictImplementation(self)

Modified: pypy/dist/pypy/objspace/std/test/test_dictobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_dictobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_dictobject.py	Sun Mar  4 12:45:20 2007
@@ -4,7 +4,7 @@
 class TestW_DictObject:
 
     def setup_class(cls):
-        cls.space = gettestobjspace(**{"objspace.std.withstrdict": False})
+        cls.space = gettestobjspace()
 
     def test_empty(self):
         space = self.space

Modified: pypy/dist/pypy/objspace/std/test/test_proxy.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_proxy.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_proxy.py	Sun Mar  4 12:45:20 2007
@@ -120,5 +120,5 @@
 
 class AppTestDictStrProxy(AppTestDictProxy):
     def setup_class(cls):
-        cls.space = gettestobjspace(**{"objspace.std.withstrdict": True,
+        cls.space = gettestobjspace(**{"objspace.std.withmultidict": True,
                                        "objspace.std.withtproxy": True})



More information about the Pypy-commit mailing list