[IronPython] IronPython 2.6 CodePlex Source Update

merllab at microsoft.com merllab at microsoft.com
Wed Mar 24 16:53:56 CET 2010


This is an automated email letting you know that sources 
have recently been pushed out.  You can download these newer 
sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/64949.

ADDED SOURCES
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/ConstantDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/EmptyDictionaryStorage.cs

MODIFIED SOURCES
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/ConstantDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Compiler/Ast/AstMethods.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/AttributesDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/CustomDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/BuiltinsDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/CommonDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/DictionaryOps.cs
	$/IronPython/IronPython_Main/Src/IronPython.Modules/thread.cs
	$/IronPython/IronPython_Main/Src/IronPython/Compiler/Ast/TupleExpression.cs
	$/IronPython/IronPython_Main/Src/IronPython/Compiler/Ast/Expression.cs
	$/IronPython/IronPython_Main/Src/IronPython/Compiler/Ast/DictionaryExpression.cs
	$/IronPython/IronPython_Main/Src/IronPython/Compiler/Ast/ConstantExpression.cs
	$/IronPython/IronPython_Main/Src/IronPython/IronPython.csproj
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/EmptyDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/StringDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/ModuleDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/PythonDictionary.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/ScopeDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/DictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/Operations/PythonOps.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/ObjectAttributesAdapter.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/Types/CustomInstanceDictionaryStorage.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/Types/OldClass.cs
	$/IronPython/IronPython_Main/Src/IronPython/Runtime/WrapperDictionary.cs
	$/IronPython/IronPython_Main/Src/IronPythonTest/EngineTest.cs
	$/IronPython/IronPython_Main/Src/IronPythonTest/StringDictionaryStorage.cs
	$/IronPython/IronPython_Main/Tutorial/Tutorial.htm

CHECKIN COMMENTS
--------------------------------------------------------------------------------
Changeset Id: 1695947
Date: 3/23/2010 10:57:21 AM

Optimize dictionaries for size which also slightly improves throughput.  Switches to using open addressing instead of chaining buckets.  We now store an array of Bucket[] structs.   Also moves the storage for the null key into its own object rather than storing it with the rest of the values.  Because Bucket is now a struct we can no longer have a special DeserializationBucket – instead we now have a special DeserializationNullValue.  The net result is that each bucket is now half the size (3 fields vs. 4 fields + vtable + sync header).  But we also now need to keep the table below a load factor of .7.  But the end result is a net win on size overall and better cache locality.

Also optimizes the storage of empty dictionaries – we change the API on DictionaryStorage so that it passes in the address of where the storage lives.  If the current storage wants to change its type it can update the reference passed in so that we switch storages.  This is currently done with the empty dictionary storage and the constant dictionary storage.  When we create a new empty dictionary it shares a common instance of EmptyDictionaryStorage.  Any attempts to mutate it result in the creation of a new CommonDictionaryStorage which contains the new values.  Likewise there’s also a ConstantDictionaryStorage which does a similar thing.  

Long term this can be used for other optimizations – for example we can implement StringDictionaryStorage and IntDictionaryStorage this way so that we don’t need to do a delegate invocation to hash the keys, instead it can all be in-lined.  It also might open up the possibility to storing value types in a non-boxed fashion down the line but I think there are more issues which need to be dealt with for that to perform well.

Also added some tests to make sure we get the thread safety right of switching between EmptyDictionaryStorage and ConstantDictionaryStorage.



(Shelveset: dinov1_0;REDMOND\dinov | SNAP CheckinId: 10570)



More information about the Ironpython-users mailing list