Index: anches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Core/DataMemberAccessor.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Core/DataMemberAccessor.cs	(revision 6213)
+++ 	(revision )
@@ -1,251 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Reflection;
-using System.Reflection.Emit;
-
-namespace HeuristicLab.Persistence.Core {
-
-  /// <summary>
-  /// Encapsulation and abstraction for access a data member of an object
-  /// regardless of it being a property or field. Additionally a
-  /// default value and an alternate name can be specified.
-  /// </summary>
-  public sealed class DataMemberAccessor {
-
-    #region fields
-
-    /// <summary>
-    /// The function to get the value of the data member.
-    /// </summary>
-    public readonly Func<object, object> Get;
-
-    /// <summary>
-    /// The function to set the value of the data member.
-    /// </summary>
-    public readonly Action<object, object> Set;
-
-    /// <summary>
-    /// The name of the data member.
-    /// </summary>
-    public readonly string Name;
-
-    /// <summary>
-    /// The default value of the data member, can remain <c>null</c>
-    /// if no default value. If left null, this will also leave the
-    /// default value for value types (e.g. 0 for <c>int</c>).
-    /// </summary>
-    public readonly object DefaultValue;
-
-    #endregion
-
-    #region constructors
-
-    /// <summary>
-    /// Create a <see cref="DataMemberAccessor"/> from a FieldInfo or
-    /// PropertyInfo for the give object.
-    /// </summary>
-    /// <param name="memberInfo">The member info.</param>
-    /// <param name="name">The name.</param>
-    /// <param name="defaultvalue">The defaultvalue.</param>
-    public DataMemberAccessor(MemberInfo memberInfo, string name, object defaultvalue) {
-      Get = GenerateGetter(memberInfo);
-      Set = GenerateSetter(memberInfo);
-      Name = name;
-      DefaultValue = defaultvalue;
-    }
-
-    /// <summary>
-    /// Create an empty accessor that just encapsulates an object
-    /// without access.
-    /// </summary>    
-    public DataMemberAccessor() {
-      Name = null;
-      DefaultValue = null;
-      Get = Id;
-    }
-
-    /// <summary>
-    /// Create an empty accessor that just encapsulates an object
-    /// without access.
-    /// </summary>    
-    /// <param name="name">The object's name.</param>
-    public DataMemberAccessor(string name) {
-      Name = name;
-      DefaultValue = null;
-      Get = Id;
-    }
-
-    /// <summary>
-    /// Initializes a new instance of the <see cref="DataMemberAccessor"/> class using the
-    /// getter and setter from an exisiting instance but with a new name and default value.
-    /// </summary>
-    /// <param name="dma">The existing DataMemberAccessor.</param>
-    /// <param name="name">The new name.</param>
-    /// <param name="defaultValue">The new default value.</param>
-    public DataMemberAccessor(DataMemberAccessor dma, string name, object defaultValue) {
-      Get = dma.Get;
-      Set = dma.Set;
-      this.Name = name;
-      this.DefaultValue = defaultValue;
-    }
-
-    #endregion
-
-    #region auxiliary methods
-
-    /// <summary>
-    /// Returns a <see cref="System.String"/> that represents this instance.
-    /// </summary>
-    /// <returns>
-    /// A <see cref="System.String"/> that represents this instance.
-    /// </returns>
-    public override string ToString() {
-      return String.Format("DataMemberAccessor({0}, {1}, {2}, {3})",
-        Name,
-        DefaultValue ?? "<null>",
-        Get.Method, Set.Method);
-    }
-
-    /// <summary>
-    /// The identity function
-    /// </summary>
-    /// <param name="o">An object.</param>
-    /// <returns>its argument o unmodified.</returns>
-    public static object Id(object o) {
-      return o;
-    }
-
-    #endregion
-
-    #region static methods (code generators)
-
-    /// <summary>
-    /// Generate a getter for the given field or property
-    /// </summary>
-    /// <param name="memberInfo">The member info.</param>
-    /// <returns></returns>
-    public static Func<object, object> GenerateGetter(MemberInfo memberInfo) {
-      if (memberInfo.MemberType == MemberTypes.Field) {
-        FieldInfo fieldInfo = (FieldInfo)memberInfo;
-        return GenerateFieldGetter(fieldInfo);
-      } else if (memberInfo.MemberType == MemberTypes.Property) {
-        return GeneratePropertyGetter((PropertyInfo)memberInfo);
-      } else {
-        throw new PersistenceException(
-          "The Storable attribute can only be applied to fields and properties.");
-      }
-    }
-
-    /// <summary>
-    /// Generates a setter for the given field or property.
-    /// </summary>
-    /// <param name="memberInfo">The member info.</param>
-    /// <returns></returns>
-    public static Action<object, object> GenerateSetter(MemberInfo memberInfo) {
-      if (memberInfo.MemberType == MemberTypes.Field) {
-        FieldInfo fieldInfo = (FieldInfo)memberInfo;
-        return GenerateFieldSetter(fieldInfo);
-      } else if (memberInfo.MemberType == MemberTypes.Property) {
-        return GeneratePropertySetter((PropertyInfo)memberInfo);
-      } else {
-        throw new PersistenceException(
-          "The Storable attribute can only be applied to fields and properties.");
-      }
-    }
-
-    /// <summary>
-    /// Generates a dynamically compiled getter to access fields (even private ones).
-    /// </summary>
-    /// <param name="fieldInfo">The field info.</param>
-    /// <returns>A Func&lt;object, object&gt;</returns>
-    public static Func<object, object> GenerateFieldGetter(FieldInfo fieldInfo) {
-      DynamicMethod dm = new DynamicMethod("", typeof(object), new Type[] { typeof(object) }, fieldInfo.DeclaringType, true);
-      ILGenerator ilgen = dm.GetILGenerator();
-      ilgen.Emit(OpCodes.Ldarg_0);
-      ilgen.Emit(OpCodes.Castclass, fieldInfo.DeclaringType);
-      ilgen.Emit(OpCodes.Ldfld, fieldInfo);
-      ilgen.Emit(OpCodes.Box, fieldInfo.FieldType);
-      ilgen.Emit(OpCodes.Ret);
-      return (Func<object, object>)dm.CreateDelegate(typeof(Func<object, object>));
-    }
-
-    /// <summary>
-    /// Generates a dynamically compiled setter to access fields (even private ones).
-    /// </summary>
-    /// <param name="fieldInfo">The field info.</param>
-    /// <returns>An Action&lt;object, object%gt;</returns>
-    public static Action<object, object> GenerateFieldSetter(FieldInfo fieldInfo) {
-      DynamicMethod dm = new DynamicMethod("", null, new Type[] { typeof(object), typeof(object) }, fieldInfo.DeclaringType, true);
-      ILGenerator ilgen = dm.GetILGenerator();
-      ilgen.Emit(OpCodes.Ldarg_0);
-      ilgen.Emit(OpCodes.Castclass, fieldInfo.DeclaringType);
-      ilgen.Emit(OpCodes.Ldarg_1);
-      ilgen.Emit(OpCodes.Unbox_Any, fieldInfo.FieldType);
-      ilgen.Emit(OpCodes.Stfld, fieldInfo);
-      ilgen.Emit(OpCodes.Ret);
-      return (Action<object, object>)dm.CreateDelegate(typeof(Action<object, object>));
-    }
-
-    /// <summary>
-    /// Generates a dynamically compiled getter to access properties (even private ones).
-    /// </summary>
-    /// <param name="propertyInfo">The property info.</param>
-    /// <returns>A Func&lt;object, object&gt;</returns>
-    public static Func<object, object> GeneratePropertyGetter(PropertyInfo propertyInfo) {
-      MethodInfo getter = propertyInfo.GetGetMethod(true);
-      if (getter == null)
-        return null;
-      DynamicMethod dm = new DynamicMethod("", typeof(object), new Type[] { typeof(object) }, propertyInfo.DeclaringType, true);
-      ILGenerator ilgen = dm.GetILGenerator();
-      ilgen.Emit(OpCodes.Ldarg_0);
-      ilgen.Emit(OpCodes.Castclass, propertyInfo.DeclaringType);
-      ilgen.Emit(OpCodes.Callvirt, getter);
-      ilgen.Emit(OpCodes.Box, propertyInfo.PropertyType);
-      ilgen.Emit(OpCodes.Ret);
-      return (Func<object, object>)dm.CreateDelegate(typeof(Func<object, object>));
-    }
-
-    /// <summary>
-    /// Generates a dynamically compiled setter to access properties (even private ones).
-    /// </summary>
-    /// <param name="propertyInfo">The property info.</param>
-    /// <returns>An Action&lt;object, object%gt;</returns>
-    public static Action<object, object> GeneratePropertySetter(PropertyInfo propertyInfo) {
-      MethodInfo setter = propertyInfo.GetSetMethod(true);
-      if (setter == null)
-        return null;
-      DynamicMethod dm = new DynamicMethod("", null, new Type[] { typeof(object), typeof(object) }, propertyInfo.DeclaringType, true);
-      ILGenerator ilgen = dm.GetILGenerator();
-      ilgen.Emit(OpCodes.Ldarg_0);
-      ilgen.Emit(OpCodes.Castclass, propertyInfo.DeclaringType);
-      ilgen.Emit(OpCodes.Ldarg_1);
-      ilgen.Emit(OpCodes.Unbox_Any, propertyInfo.PropertyType);
-      ilgen.Emit(OpCodes.Callvirt, setter);
-      ilgen.Emit(OpCodes.Ret);
-      return (Action<object, object>)dm.CreateDelegate(typeof(Action<object, object>));
-    }
-
-    #endregion
-  }
-
-}
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Core/Serializer.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Core/Serializer.cs	(revision 6213)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Core/Serializer.cs	(revision 6214)
@@ -189,5 +189,5 @@
     /// </returns>
     public IEnumerator<ISerializationToken> GetEnumerator() {
-      var enumerator = Serialize(new DataMemberAccessor(rootName), obj);
+      var enumerator = Serialize(rootName, obj);
       if (isTestRun) {
         return AddExceptionCompiler(enumerator);
@@ -208,12 +208,12 @@
     private Stack<string> objectGraphTrace = new Stack<string>();
 
-    private IEnumerator<ISerializationToken> Serialize(DataMemberAccessor accessor, object obj) {
-
-      object value = accessor.Get(obj);
+    private IEnumerator<ISerializationToken> Serialize(string name, object obj) {
+
+      object value = obj;
       if (value == null)
-        return NullReferenceEnumerator(accessor.Name);
+        return NullReferenceEnumerator(name);
       Type type = value.GetType();
       if (obj2id.ContainsKey(value))
-        return ReferenceEnumerator(accessor.Name, obj2id[value]);
+        return ReferenceEnumerator(name, obj2id[value]);
       bool emitTypeInfo = false;
       if (!typeCache.ContainsKey(type)) {
@@ -228,9 +228,9 @@
       }
       try {
-        objectGraphTrace.Push(accessor.Name);
+        objectGraphTrace.Push(name);
         IPrimitiveSerializer primitiveSerializer = configuration.GetPrimitiveSerializer(type);
         if (primitiveSerializer != null)
           return PrimitiveEnumerator(
-            accessor.Name,
+            name,
             typeId,
             primitiveSerializer.Format(value),
@@ -240,5 +240,5 @@
         if (compositeSerializer != null)
           return CompositeEnumerator(
-            accessor.Name,
+            name,
             compositeSerializer.Decompose(value),
             id,
@@ -315,5 +315,5 @@
       if (metaInfo != null) {
         foreach (var tag in metaInfo) {
-          IEnumerator<ISerializationToken> metaIt = Serialize(new DataMemberAccessor(tag.Name), tag.Value);
+          IEnumerator<ISerializationToken> metaIt = Serialize(tag.Name, tag.Value);
           while (metaIt.MoveNext()) {
             if (first) {
@@ -330,5 +330,5 @@
       if (tags != null) {
         foreach (var tag in tags) {
-          IEnumerator<ISerializationToken> it = Serialize(new DataMemberAccessor(tag.Name), tag.Value);
+          IEnumerator<ISerializationToken> it = Serialize(tag.Name, tag.Value);
           while (it.MoveNext())
             yield return it.Current;
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/FieldDescriptor.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/FieldDescriptor.cs	(revision 6214)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/FieldDescriptor.cs	(revision 6214)
@@ -0,0 +1,149 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors {
+
+  /// <summary>
+  /// Describes the field of a type.
+  /// </summary>
+  [StorableClass]
+  public sealed class FieldDescriptor : ITypeComponent, ICloneable {
+
+    #region Fields & Properties
+    
+    /// <summary>
+    /// The type that declared this field.
+    /// </summary>
+    [Storable]
+    public TypeDescriptor DeclaringType { get; set; }
+
+    /// <summary>
+    /// The field name in the object graph as obtained by reflection.
+    /// </summary>
+    [Storable]
+    public string RealName { get; set; }
+
+    /// <summary>
+    /// The name used for storing this field if different from the
+    /// the real name.
+    /// </summary>
+    [Storable]
+    public string StoredName { get; set; }
+
+    /// <summary>
+    /// The default value of this field (if any) when no value
+    /// was found during deserialization.
+    /// </summary>
+    [Storable]
+    public object DefaultValue { get; set; }
+
+    /// <summary>
+    /// The name used for (de)serialization which is either the
+    /// StoredName (if present) or otherwise the RealName.
+    /// </summary>
+    public string Name { get { return StoredName ?? RealName; } }
+
+    private FieldInfo handle;
+    /// <summary>
+    /// The FieldInfo as obtained by reflection representing the
+    /// described type.
+    /// </summary>
+    public FieldInfo Handle {
+      get {
+        try {
+          if (handle == null)
+            handle = DeclaringType.Handle.GetField(RealName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
+        } catch { }
+        return handle;
+      }
+    }
+    #endregion
+    
+    [StorableConstructor]
+    private FieldDescriptor(bool deserializing) { }
+
+    /// <summary>
+    /// Create a new field descriptor.
+    /// </summary>
+    /// <param name="declaringType">The type declaring this field.</param>
+    /// <param name="fieldInfo">The field info obtained by reflection.</param>
+    /// <param name="attribute">The storable attribute (if any) of this field.</param>
+    public FieldDescriptor(TypeDescriptor declaringType, FieldInfo fieldInfo, StorableAttribute attribute) {
+      DeclaringType = declaringType;
+      RealName = fieldInfo.Name;
+      if (attribute != null) {
+        StoredName = attribute.Name;
+        DefaultValue = attribute.DefaultValue;
+      }
+      handle = fieldInfo;
+    }
+
+    /// <summary>
+    /// Create a string representation of this field descriptor.
+    /// </summary>
+    public override string ToString() {
+      StringBuilder sb = new StringBuilder();
+      sb.Append(RealName);
+      if (StoredName != null)
+        sb.AppendFormat(" ({0})", StoredName);
+      if (DefaultValue != null)
+        sb.AppendFormat(" [{0}]", DefaultValue);
+      return sb.ToString();
+    }
+
+    /// <summary>
+    /// Creates a shallow copy of this field descriptor.
+    /// </summary>
+    public object Clone() {
+      var clone = new FieldDescriptor(false);
+      clone.DeclaringType = DeclaringType;
+      clone.RealName = RealName;
+      clone.StoredName = StoredName;
+      clone.DefaultValue = DefaultValue;
+      clone.handle = handle;
+      return clone;
+    }
+
+    /// <summary>
+    /// From the given object return the value of the
+    /// field described by this field descriptor.
+    /// </summary>
+    public object GetValue(object o) {
+      return Handle.GetValue(o);
+    }
+
+    /// <summary>
+    /// From the given object set the value of the
+    /// field described by this field descriptor.
+    /// </summary>
+    public void SetValue(object o, object value) {
+      Handle.SetValue(o, value);
+    }
+
+  }
+
+}
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/HookDescriptor.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/HookDescriptor.cs	(revision 6214)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/HookDescriptor.cs	(revision 6214)
@@ -0,0 +1,111 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Persistence.Auxiliary;
+
+namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors {
+
+  /// <summary>
+  /// Describes a storable hook method of a storable type.
+  /// </summary>
+  [StorableClass]
+  public sealed class HookDescriptor {
+
+    #region Fields & Properties
+    /// <summary>
+    /// The type that declared this hook.
+    /// </summary>
+    [Storable]
+    public TypeDescriptor DeclaringType { get; set; }
+
+    /// <summary>
+    /// The name of the method that represents this hook.
+    /// </summary>
+    [Storable]
+    public string MethodName { get; set; }
+
+    /// <summary>
+    /// The type of the hook.
+    /// </summary>
+    [Storable]
+    public HookType HookType { get; set; }
+
+    private MethodInfo handle;
+    /// <summary>
+    /// The MethodInfo of the hook as obtained by reflection.
+    /// </summary>
+    public MethodInfo Handle {
+      get {
+        try {
+          if (handle == null)
+            handle = DeclaringType.Handle.GetMethod(MethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
+        } catch { }
+        return handle;
+      }
+      internal set {
+        handle = value;
+      }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private HookDescriptor(bool deserializing) { }
+
+    /// <summary>
+    /// Creates a new hook description.
+    /// </summary>
+    /// <param name="declaringType">The declaring type.</param>
+    /// <param name="methodInfo">The MethodInfo as obtained by reflection.</param>
+    /// <param name="hookType">The hook type.</param>
+    public HookDescriptor(TypeDescriptor declaringType, MethodInfo methodInfo, HookType hookType) {
+      DeclaringType = declaringType;
+      MethodName = methodInfo.Name;
+      HookType = hookType;
+      handle = methodInfo;
+    }
+
+    /// <summary>
+    /// Invokes the hook method on the given object.
+    /// </summary>
+    public void Invoke(object o) {
+      Handle.Invoke(o, Type.EmptyTypes);
+    }
+
+    /// <summary>
+    /// Creates a string representation of this hook description.
+    /// </summary>
+    public override string ToString() {
+      return new StringBuilder()
+        .Append(HookType.ToString())
+        .Append(' ')
+        .Append(TypeNameParser.Parse(DeclaringType.AssemblyQualifiedName).ClassName)
+        .Append('.')
+        .Append(MethodName)
+        .Append("()")
+        .ToString();
+    }
+  }
+}
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/ITypeComponent.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/ITypeComponent.cs	(revision 6214)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/ITypeComponent.cs	(revision 6214)
@@ -0,0 +1,42 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors {
+
+  /// <summary>
+  /// Named component of the type (i.e. either a field or property).
+  /// </summary>
+  public interface ITypeComponent {
+
+    /// <summary>
+    /// The name of the component.
+    /// </summary>
+    string Name { get; }
+  }
+
+}
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/PropertyDescriptor.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/PropertyDescriptor.cs	(revision 6214)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/PropertyDescriptor.cs	(revision 6214)
@@ -0,0 +1,190 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors {
+
+  /// <summary>
+  /// Describes a property of a type.
+  /// </summary>
+  [StorableClass]
+  public sealed class PropertyDescriptor : ITypeComponent {
+
+    /// <summary>
+    /// The type descriptor of the type who declared this property. This
+    /// can be different to the type where this property was obtained from
+    /// if it has been inherited.
+    /// </summary>
+    [Storable]
+    public TypeDescriptor DeclaringType { get; set; }
+
+    /// <summary>
+    /// The real name (i.e. in the object graph) of the property.
+    /// </summary>
+    [Storable]
+    public string RealName { get; set; }
+
+    /// <summary>
+    /// The name used for seralization (i.e. possibly prefixed with
+    /// type information to avoid confusion with equally named
+    /// shadowed properties) if different to the real name.
+    /// </summary>
+    [Storable]
+    public string StoredName { get; set; }
+
+    /// <summary>
+    /// The default value (if any) of the property if not found
+    /// during deserialziation.
+    /// </summary>
+    [Storable]
+    public object DefaultValue { get; set; }
+
+    /// <summary>
+    /// Whether this property has a read accessor.
+    /// </summary>
+    [Storable]
+    public bool CanRead { get; set; }
+
+    /// <summary>
+    /// Whether this property has a write accessor.
+    /// </summary>
+    [Storable]
+    public bool CanWrite { get; set; }
+
+    /// <summary>
+    /// The actual name used for serialization (either the stored name
+    /// if present, otherwise the real name).
+    /// </summary>
+    public string Name { get { return StoredName ?? RealName; } }
+
+    #region Activation
+    private PropertyInfo handle;
+    /// <summary>
+    /// The PropertyInfo object as obtained by reflection representing
+    /// the described type.
+    /// </summary>
+    public PropertyInfo Handle {
+      get {
+        try {
+          if (handle == null)
+            handle = DeclaringType.Handle.GetProperty(RealName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
+        } catch { }
+        return handle;
+      }
+      internal set {
+        handle = value;
+      } 
+    }
+    #endregion
+
+    /// <summary>
+    /// The type who initially declared this property. This is usually the
+    /// first base type who declared this property even though it has been overridden
+    /// serveral times. If it has been newly declared using <code>new</code>
+    /// the type who shadowed it with new is returned.
+    /// </summary>
+    public Type DeclaringBaseType {
+      get {
+        if (CanRead)
+          return Handle.GetGetMethod().GetBaseDefinition().DeclaringType;
+        if (CanWrite)
+          return Handle.GetSetMethod().GetBaseDefinition().DeclaringType;
+        return Handle.DeclaringType;
+      }
+    }
+
+    [StorableConstructor]
+    private PropertyDescriptor(bool deserializing)  { }
+
+    /// <summary>
+    /// Create a new property descriptor.
+    /// </summary>
+    /// <param name="declaringType">The declaring type.</param>
+    /// <param name="propertyInfo">The reflection information.</param>
+    /// <param name="attribute">The storable attribute of this property (if any).</param>
+    public PropertyDescriptor(TypeDescriptor declaringType, PropertyInfo propertyInfo, StorableAttribute attribute) {
+      DeclaringType = declaringType;
+      RealName = propertyInfo.Name;
+      if (attribute != null) {
+        StoredName = attribute.Name;
+        DefaultValue = attribute.DefaultValue;
+      }
+      CanRead = propertyInfo.CanRead;
+      CanWrite = propertyInfo.CanWrite;
+      Handle = propertyInfo;
+    }
+
+    /// <summary>
+    /// Create a shallow copy of this property descriptor.
+    /// </summary>
+    public object Clone() {
+      var clone = new PropertyDescriptor(false);
+      clone.DeclaringType = DeclaringType;
+      clone.RealName = RealName;
+      clone.StoredName = StoredName;
+      clone.DefaultValue = DefaultValue;
+      clone.CanRead = CanRead;
+      clone.CanWrite = CanWrite;
+      clone.handle = handle;
+      return clone;
+    }
+
+    /// <summary>
+    /// Create a string representation of this property descriptor.
+    /// </summary>
+    public override string ToString() {
+      StringBuilder sb = new StringBuilder();
+      sb.Append(base.ToString());
+      if (CanRead && !CanWrite)
+        sb.Append(" {RO}");
+      else if (CanWrite && !CanRead)
+        sb.Append(" {WO}");
+      else if (CanRead && CanWrite)
+        sb.Append(" {R/W}");
+      else
+        sb.Append(" {!!! MUTE !!!}");
+      return sb.ToString();
+    }
+
+    /// <summary>
+    /// From the given object obtain the property value that
+    /// is described by this property descriptor.
+    /// </summary>
+    public object GetValue(object o) {
+      return Handle.GetValue(o, null);
+    }
+
+    /// <summary>
+    /// From the given object set the property value that
+    /// is described by this property descriptor.
+    /// </summary>
+    public void SetValue(object o, object value) {
+      Handle.SetValue(o, value, null);
+    }
+  }
+
+}
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/TypeDescriptor.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/TypeDescriptor.cs	(revision 6214)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/TypeDescriptor.cs	(revision 6214)
@@ -0,0 +1,295 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors {
+
+  /// <summary>
+  /// Type descriptor containing all relevant reflection information for serialization and
+  /// deserialization of storable types.
+  /// </summary>
+  [StorableClass]
+  public sealed class TypeDescriptor {
+
+    #region Properties
+    /// <summary>
+    /// Type descriptor of the base class
+    /// </summary>
+    [Storable]
+    public TypeDescriptor BaseTypeDescriptor { get; set; }
+
+    /// <summary>
+    /// Whether the type is marked as storable class or not.
+    /// </summary>
+    [Storable]
+    public bool IsStorableClass { get; set; }
+
+    /// <summary>
+    /// The assembly qualified name of the type.
+    /// </summary>
+    [Storable]
+    public string AssemblyQualifiedName { get; set; }
+
+    /// <summary>
+    /// Whether the type has a default contructor.
+    /// </summary>
+    [Storable]
+    public bool HasDefaultConstructor { get; set; }
+
+    /// <summary>
+    /// Whether the type has a storable constructor. (One bool argument
+    /// and marked with the [StorableConstructor] attribute.
+    /// </summary>
+    [Storable]
+    public bool HasStorableConstructor { get; set; }
+
+    /// <summary>
+    /// A list of field descriptors describing all storable fields.
+    /// </summary>
+    [Storable]
+    public List<FieldDescriptor> Fields { get; set; }
+
+    /// <summary>
+    /// A list of property descriptors describing all storable properties.
+    /// </summary>
+    [Storable]
+    public List<PropertyDescriptor> Properties { get; set; }
+
+    /// <summary>
+    /// A list of hook descriptors describing all storable hooks.
+    /// </summary>
+    [Storable]
+    public List<HookDescriptor> Hooks { get; set; }
+
+    /// <summary>
+    /// Indicates that the given type is incompatible with the storable serializer.
+    /// </summary>
+    [Storable]
+    public bool IsInvalid { get; set; }
+
+    private Type handle;
+    /// <summary>
+    /// Get the System.Type handle representing this type.
+    /// </summary>
+    public Type Handle {
+      get {
+        if (handle != null)
+          return handle;
+        try {
+          handle = Type.GetType(AssemblyQualifiedName);
+          return handle;
+        } catch {
+          return null;
+        }
+      }
+    }
+    #endregion
+
+    #region Constants
+    private static BindingFlags ALL_INSTANCE = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
+    private static Type[] ONE_ARG_BOOL = new[] { typeof(bool) };
+    #endregion
+
+    #region Cache
+    private ConstructorInfo storableConstructor;
+    /// <summary>
+    /// Get the constructor info of the storable constructor (if any).
+    /// </summary>
+    public ConstructorInfo StorableConstructor {
+      get {
+        if (storableConstructor == null && HasStorableConstructor)
+          storableConstructor = Handle.GetConstructor(ALL_INSTANCE, null, Type.EmptyTypes, null);
+        return storableConstructor;
+      }
+      internal set {
+        storableConstructor = value;
+      }
+    }
+
+    private ConstructorInfo defaultConstructor;
+    /// <summary>
+    /// Get the constructor info of the default constructor (if any).
+    /// </summary>
+    public ConstructorInfo DefaultConstructor {
+      get {
+        if (defaultConstructor == null && HasDefaultConstructor)
+          defaultConstructor = Handle.GetConstructor(ALL_INSTANCE, null, ONE_ARG_BOOL, null);
+        return defaultConstructor;
+      }
+      internal set {
+        defaultConstructor = value;
+      }
+    }
+    #endregion
+
+    /// <summary>
+    /// Empty storable constructor.
+    /// </summary>
+    [StorableConstructor]
+    private TypeDescriptor(bool deserializing) { }
+
+    /// <summary>
+    /// Instantiate a new type descriptor for the given type. This does not add any
+    /// methods, fields or properties and should only by called within a
+    /// discovery service such as the <code>StorableClassAnalyzer</code>.
+    /// </summary>
+    /// <param name="handle"></param>
+    public TypeDescriptor(Type handle) {
+      if (handle.ContainsGenericParameters)
+        throw new ArgumentException("Can only create type descriptor for types without generic type parameters (closed)");
+      this.handle = handle;
+      AssemblyQualifiedName = handle.AssemblyQualifiedName;
+      Fields = new List<FieldDescriptor>();
+      Properties = new List<PropertyDescriptor>();
+      Hooks = new List<HookDescriptor>();
+    }
+
+    /// <summary>
+    /// Ensures that field and property names of this class and its base classes
+    /// do not collide by prefixing them if necessary.
+    /// </summary>
+    public void Disentangle() {
+      if (BaseTypeDescriptor != null)
+        AnalyzeBaseClass();
+      DisentangleFields();
+      DisentangleProperties();
+    }
+
+    private void AnalyzeBaseClass() {
+      Fields = BaseTypeDescriptor.Fields.Select(f => (FieldDescriptor)f.Clone()).Concat(Fields).ToList();
+      Properties = BaseTypeDescriptor.Properties.Select(p => (PropertyDescriptor)p.Clone()).Concat(Properties).ToList();
+      Hooks = BaseTypeDescriptor.Hooks.Concat(Hooks).ToList();
+    }
+
+    private void DisentangleFields() {
+      var nameGroups = GroupByName(Fields);
+      foreach (var group in nameGroups.Values) {
+        if (group.Count > 1) {
+          foreach (var f in group) {
+            if (f.StoredName != null) {
+              f.StoredName = string.Format("{0}.{1}", f.DeclaringType.AssemblyQualifiedName, f.StoredName);
+            }
+          }
+        }
+      }
+    }
+
+    private void DisentangleProperties() {
+      if (Handle == null)
+        throw new InvalidOperationException(string.Format(
+          "Cannot disentangle properties. Type {0} cannot be activated and is either not loaded or outdated", AssemblyQualifiedName));
+
+      var nameGroups = GroupByName(Properties);
+      Properties.Clear();
+      foreach (var group in nameGroups.Values) {
+        if (group.Count == 1) {
+          Properties.Add(group[0]);
+        } else {
+          var uniqueAccessors = new Dictionary<Type, PropertyDescriptor>();
+          foreach (var pi in group)
+            uniqueAccessors[pi.DeclaringBaseType] = pi;
+          foreach (var pi in uniqueAccessors.Values) {
+            pi.StoredName = pi.DeclaringBaseType.FullName + pi.RealName;
+          }
+          Properties.AddRange(uniqueAccessors.Select(kvp => kvp.Value));
+        }
+      }
+    }
+
+    private static Dictionary<string, List<T>> GroupByName<T>(IEnumerable<T> fields) where T : ITypeComponent {
+      var nameGroups = new Dictionary<string, List<T>>();
+      foreach (var field in fields) {
+        if (!nameGroups.ContainsKey(field.Name))
+          nameGroups[field.Name] = new List<T>() { field };
+        else
+          nameGroups[field.Name].Add(field);
+      }
+      return nameGroups;
+    }
+
+    /// <summary>
+    /// Creates a string representation of this type descriptor.
+    /// </summary>
+    public override string ToString() {
+      StringBuilder sb = new StringBuilder();
+      if (IsStorableClass)
+        sb.Append("[StorableClass] ");
+      sb.Append(AssemblyQualifiedName);
+      if (handle != null)
+        sb.Append("*");
+      if (HasDefaultConstructor)
+        sb.Append(" ()");
+      if (HasStorableConstructor)
+        sb.Append(" (bool)");
+      sb.AppendLine();
+      foreach (var field in Fields)
+        sb.Append("  F ").AppendLine(field.ToString());
+      foreach (var property in Properties)
+        sb.Append("  P ").AppendLine(property.ToString());
+      foreach (var hook in Hooks)
+        sb.Append("  H ").AppendLine(hook.ToString());
+      return sb.ToString();
+    }
+
+    private Func<object, Dictionary<string, object>> decomposeMethod;
+    private Action<object, Dictionary<string, object>> populateMathod;
+    private Func<object> createInstanceMethod;
+
+    /// <summary>
+    /// Decomposes objects as described by this type descriptor.
+    /// </summary>
+    /// <param name="o">The object to decompose.</param>
+    /// <returns>A dictionary of component names (fields &amp; properites) and its values.</returns>
+    public Dictionary<string, object> Decompose(object o) {
+      if (decomposeMethod == null)
+        decomposeMethod = TypeSerializationCompiler.GenerateDecomposeMethod(this);
+      return decomposeMethod(o);
+    }
+
+    /// <summary>
+    /// Populates objects as described by this type descriptor.
+    /// </summary>
+    /// <param name="instance">The instance whose fields a properties should be set.</param>
+    /// <param name="values">A dictionary of names (fields &amp; properties) and their new values.</param>
+    public void Populate(object instance, Dictionary<string, object> values) {
+      if (populateMathod == null)
+        populateMathod = TypeSerializationCompiler.GeneratePopulateMethod(this);
+      populateMathod(instance, values);
+    }
+
+    /// <summary>
+    /// Creates an instance of the described type using either the storable
+    /// constructor if availble or the default constructor otherwise.
+    /// </summary>
+    /// <returns>A fresh instance of the described type.</returns>
+    public object CreateInstance() {
+      if (createInstanceMethod == null)
+        createInstanceMethod = TypeSerializationCompiler.GenerateCreateInstanceMethod(this);
+      return createInstanceMethod();
+    }
+
+  }
+}
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/TypeSerializationCompiler.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/TypeSerializationCompiler.cs	(revision 6214)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/TypeSerializationCompiler.cs	(revision 6214)
@@ -0,0 +1,223 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System.Reflection.Emit;
+
+namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors {
+
+  public static class TypeSerializationCompiler {
+
+    #region Reflection Constants
+    private static readonly ConstructorInfo DictionaryConstructor =
+      typeof(Dictionary<string, object>).GetConstructor(Type.EmptyTypes);
+
+    private static readonly MethodInfo DictionaryAdd =
+      typeof(Dictionary<string, object>).GetMethod("Add");
+
+    private static readonly MethodInfo DictionaryTryGetValue =
+      typeof(Dictionary<string, object>).GetMethod("TryGetValue");
+    #endregion
+
+    #region interface methods
+    /// <summary>
+    /// Generate a decompose method delegate for the given type.
+    /// </summary>
+    /// <param name="typeDescriptor">The type descriptor.</param>
+    /// <returns>A lambda function to decompose the given type.</returns>
+    public static Func<object, Dictionary<string, object>> GenerateDecomposeMethod(TypeDescriptor typeDescriptor) {
+      DynamicMethod dm = new DynamicMethod("", typeof(Dictionary<string, object>), new Type[] { typeof(object) }, typeDescriptor.Handle, true);
+      ILGenerator ilgen = dm.GetILGenerator();
+      CreateDictionary(ilgen);
+      foreach (HookDescriptor hook in typeDescriptor.Hooks.Where(h => h.HookType == HookType.BeforeSerialization))
+        CallHook(ilgen, hook);
+      foreach (var field in typeDescriptor.Fields)
+         GetField(ilgen, field);
+      foreach (var property in typeDescriptor.Properties)
+        GetProperty(ilgen, property);
+      ilgen.Emit(OpCodes.Ldloc_0);
+      ilgen.Emit(OpCodes.Ret);
+      return (Func<object, Dictionary<string, object>>)dm.CreateDelegate(typeof(Func<object, Dictionary<string, object>>));
+    }
+
+    /// <summary>
+    /// Generate a populate method delegate for the given type.
+    /// </summary>
+    /// <param name="typeDescriptor">The type descriptor.</param>
+    /// <returns>A lambda function to populate the given type.</returns>
+    public static Action<object, Dictionary<string, object>> GeneratePopulateMethod(TypeDescriptor typeDescriptor) {
+      DynamicMethod dm = new DynamicMethod("", null, new Type[] { typeof(object), typeof(Dictionary<string, object>), typeof(object[])}, typeDescriptor.Handle, true);
+      dm.InitLocals = false;
+      ILGenerator ilgen = dm.GetILGenerator();
+      ilgen.DeclareLocal(typeof(object));
+      var defaultValues = new List<object>();
+      foreach (var field in typeDescriptor.Fields) {
+        SetField(ilgen, field, defaultValues.Count);
+        if (field.DefaultValue != null)
+          defaultValues.Add(field.DefaultValue);
+      }
+      foreach (var property in typeDescriptor.Properties) {
+        SetProperty(ilgen, property, defaultValues.Count);
+        if (property.DefaultValue != null)
+          defaultValues.Add(property.DefaultValue);
+      }
+      foreach (HookDescriptor hook in typeDescriptor.Hooks.Where(h => h.HookType == HookType.AfterDeserialization))
+        CallHook(ilgen, hook);
+      ilgen.Emit(OpCodes.Ret);
+      var action = (Action<object, Dictionary<string, object>, object[]>)dm.CreateDelegate(typeof(Action<object, Dictionary<string, object>, object[]>));
+      return new Action<object, Dictionary<string, object>>((instance, values) => {
+        action(instance, values, defaultValues.ToArray());
+      });
+    }
+
+    /// <summary>
+    /// Generate a create instance method delegete to instantiate the given type.
+    /// </summary>
+    /// <param name="typeDescriptor">The type descriptor.</param>
+    /// <returns>A lambda function to instantiate the given type.</returns>
+    public static Func<object> GenerateCreateInstanceMethod(TypeDescriptor typeDescriptor) {
+      DynamicMethod dm = new DynamicMethod("", typeof(object), null, typeDescriptor.Handle, true);
+      ILGenerator ilgen = dm.GetILGenerator();
+      if (typeDescriptor.HasStorableConstructor) {
+        ilgen.Emit(OpCodes.Ldc_I4_1); // load true
+        ilgen.Emit(OpCodes.Newobj, typeDescriptor.StorableConstructor);
+      } else if (typeDescriptor.HasDefaultConstructor) {
+        ilgen.Emit(OpCodes.Newobj, typeDescriptor.DefaultConstructor);
+      } else {
+        throw new InvalidOperationException("Cannot create instance: No StorableConstructor and no default constructor");
+      }
+      ilgen.Emit(OpCodes.Ret);
+      return (Func<object>)dm.CreateDelegate(typeof(Func<object>));
+    }
+    #endregion
+
+    #region auxiliary functions
+    /// <summary>
+    /// Generate <code>var values = new Dictionary<string, object>();</code>.
+    /// </summary>
+    private static void CreateDictionary(ILGenerator ilgen) {
+      ilgen.DeclareLocal(typeof(Dictionary<string, object>));
+      ilgen.Emit(OpCodes.Newobj, DictionaryConstructor);
+      ilgen.Emit(OpCodes.Stloc_0);
+    }
+
+    /// <summary>
+    /// Generate <code>obj.hook();</code>.
+    /// </summary>
+    private static void CallHook(ILGenerator ilgen, HookDescriptor hook) {
+      ilgen.Emit(OpCodes.Ldarg_0); // load this
+      ilgen.Emit(OpCodes.Castclass, hook.DeclaringType.Handle);
+      ilgen.Emit(OpCodes.Callvirt, hook.Handle); // ((<type>)obj).<method>()
+    }
+
+    /// <summary>
+    /// Generate <code>values.add(field.Name, obj.field);</code>.
+    /// </summary>
+    private static void GetField(ILGenerator ilgen, FieldDescriptor field) {
+      ilgen.Emit(OpCodes.Ldloc_0); // load dict
+      ilgen.Emit(OpCodes.Ldstr, field.Name); 
+      ilgen.Emit(OpCodes.Ldarg_0); // load this
+      ilgen.Emit(OpCodes.Castclass, field.DeclaringType.Handle);
+      ilgen.Emit(OpCodes.Ldfld, field.Handle);
+      if (field.Handle.FieldType.IsValueType)
+        ilgen.Emit(OpCodes.Box, field.Handle.FieldType);
+      ilgen.Emit(OpCodes.Callvirt, DictionaryAdd);
+    }
+
+    /// <summary>
+    /// Generate <code>values.add(property.name, obj.Property);</code>.
+    /// </summary>
+    private static void GetProperty(ILGenerator ilgen, PropertyDescriptor property) {
+      if (!property.CanRead) return;
+      ilgen.Emit(OpCodes.Ldloc_0);
+      ilgen.Emit(OpCodes.Ldstr, property.Name);
+      ilgen.Emit(OpCodes.Ldarg_0);
+      ilgen.Emit(OpCodes.Castclass, property.Handle.DeclaringType);
+      ilgen.Emit(OpCodes.Callvirt, property.Handle.GetGetMethod(true));
+      if (property.Handle.PropertyType.IsValueType)
+        ilgen.Emit(OpCodes.Box, property.Handle.PropertyType);
+      ilgen.Emit(OpCodes.Callvirt, DictionaryAdd);
+    }
+
+    /// <summary>
+    /// Set the value of a field using the dictionary parameter.
+    /// </summary>
+    /// <param name="field">The descriptor of the field to set.</param>
+    /// <param name="index">The index of the default value.</param>
+    private static void SetField(ILGenerator ilgen, FieldDescriptor field, int index) {
+      ilgen.Emit(OpCodes.Ldarg_0); // load this
+      ilgen.Emit(OpCodes.Castclass, field.DeclaringType.Handle);
+      ilgen.Emit(OpCodes.Ldarg_1); // load dict
+      ilgen.Emit(OpCodes.Ldstr, field.Name);
+      ilgen.Emit(OpCodes.Ldloca_S, (byte)0); // load pointer to 'value'
+      ilgen.Emit(OpCodes.Callvirt, DictionaryTryGetValue);
+      if (field.DefaultValue == null) {
+        ilgen.Emit(OpCodes.Pop);
+      } else {
+        var endLabel = ilgen.DefineLabel();
+        ilgen.Emit(OpCodes.Brtrue_S, endLabel);
+        ilgen.Emit(OpCodes.Ldarg_2); // load defaultValues
+        ilgen.Emit(OpCodes.Ldc_I4, index);
+        ilgen.Emit(OpCodes.Ldelem, typeof(object));
+        ilgen.Emit(OpCodes.Stloc_0);
+        ilgen.MarkLabel(endLabel);
+      }
+      ilgen.Emit(OpCodes.Ldloc_0); // load value
+      ilgen.Emit(field.Handle.FieldType.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, field.Handle.FieldType);
+      ilgen.Emit(OpCodes.Stfld, field.Handle);
+    }
+
+    /// <summary>
+    /// Set the value of a property using the dictionary parameter.
+    /// </summary>
+    /// <param name="property">The descriptor of the property.</param>
+    /// <param name="index">The index of the default value.</param>
+    private static void SetProperty(ILGenerator ilgen, PropertyDescriptor property, int index) {
+      if (!property.CanWrite) return;
+      ilgen.Emit(OpCodes.Ldarg_0); // load this
+      ilgen.Emit(OpCodes.Castclass, property.DeclaringType.Handle);
+      ilgen.Emit(OpCodes.Ldarg_1); // load dict
+      ilgen.Emit(OpCodes.Ldstr, property.Name);
+      ilgen.Emit(OpCodes.Ldloca_S, (byte)0); // load pointer to 'value'
+      ilgen.Emit(OpCodes.Callvirt, DictionaryTryGetValue);
+      if (property.DefaultValue == null) {
+        ilgen.Emit(OpCodes.Pop);
+      } else {
+        var endLabel = ilgen.DefineLabel();
+        ilgen.Emit(OpCodes.Brtrue_S, endLabel);
+        ilgen.Emit(OpCodes.Ldarg_2); // load defaultValues
+        ilgen.Emit(OpCodes.Ldc_I4, index);
+        ilgen.Emit(OpCodes.Ldelem, typeof(object));
+        ilgen.Emit(OpCodes.Stloc_0);
+        ilgen.MarkLabel(endLabel);
+      }
+      ilgen.Emit(OpCodes.Ldloc_0); // load value
+      ilgen.Emit(property.Handle.PropertyType.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, property.Handle.PropertyType);
+      ilgen.Emit(OpCodes.Callvirt, property.Handle.GetSetMethod(true));
+    }
+    #endregion
+  }
+}
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAnalyzer.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAnalyzer.cs	(revision 6214)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAnalyzer.cs	(revision 6214)
@@ -0,0 +1,157 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using HeuristicLab.Persistence.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors;
+
+namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable {
+
+  /// <summary>
+  /// Analyzes storables classes and creates a datastructure containing all required
+  /// reflection information to serialize and deserialized these types.
+  /// </summary>
+  [StorableClass]
+  public sealed class StorableClassAnalyzer {
+
+    [Storable]
+    private static Dictionary<Type, TypeDescriptor> typeDescriptors;
+
+    /// <summary>
+    /// A list of all types that have been analyzed by this instance.
+    /// </summary>
+    public IEnumerable<Type> KnownTypes { get { return typeDescriptors.Keys; } }
+
+    /// <summary>
+    /// Creates a new instance of the StorableClassAnalyzer.
+    /// </summary>
+    public StorableClassAnalyzer() {
+      typeDescriptors = new Dictionary<Type, TypeDescriptor>();
+    }
+
+    /// <summary>
+    /// Retrieve analyzis results for a certain type. This either returns
+    /// already cached results or analyzes the given type and caches the
+    /// results.
+    /// </summary>
+    /// <param name="type">The type to be analyzed.</param>
+    /// <returns>A TypeDescriptor object that encapsulates all necessary reflection information.</returns>
+    public TypeDescriptor this[Type type] {
+      get {
+        TypeDescriptor typeDescriptor = null;
+        typeDescriptors.TryGetValue(type, out typeDescriptor);
+        if (typeDescriptor != null)
+          return typeDescriptor;
+        typeDescriptor = new TypeDescriptor(type);
+        AddMembers(type, typeDescriptor);
+        if (!typeDescriptor.IsInvalid) {
+          typeDescriptor.Disentangle();
+          typeDescriptors[type] = typeDescriptor;
+        }
+        return typeDescriptor;
+      }
+    }
+
+    private void AddMembers(Type type, TypeDescriptor typeDescriptor) {
+      if (type.BaseType != null) {
+        typeDescriptor.BaseTypeDescriptor = this[type.BaseType];
+        if (typeDescriptor.BaseTypeDescriptor.IsInvalid) {
+          typeDescriptor.IsInvalid = true;
+          return;
+        }
+      }
+      var attribute = (StorableClassAttribute)type.GetCustomAttributes(typeof(StorableClassAttribute), false).SingleOrDefault();
+      typeDescriptor.IsStorableClass = attribute != null;
+      foreach (MemberInfo member in type.GetMembers(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)) {
+        switch (member.MemberType) {
+          case MemberTypes.Constructor: MaybeAddConstructor((ConstructorInfo)member, typeDescriptor); break;
+          case MemberTypes.Field: MaybeAddField((FieldInfo)member, typeDescriptor, attribute); break;
+          case MemberTypes.Property: MaybeAddProperty((PropertyInfo)member, typeDescriptor, attribute); break;
+          case MemberTypes.Method: MaybeAddHook((MethodInfo)member, typeDescriptor); break;
+        }
+        if (typeDescriptor.IsInvalid) return;
+      }
+    }
+
+    private static bool IsMutableField(FieldInfo fi) {
+      return !fi.IsLiteral && !fi.IsInitOnly;
+    }
+
+    private static bool IsMutableProperty(PropertyInfo pi) {
+      return pi.CanWrite;
+    }
+
+    private static void MaybeAddConstructor(ConstructorInfo constructorInfo, TypeDescriptor typeDescriptor) {
+      ParameterInfo[] parameters = constructorInfo.GetParameters();
+      if (parameters.Length == 0) {
+        typeDescriptor.HasDefaultConstructor = true;
+        typeDescriptor.DefaultConstructor = constructorInfo;
+      }
+      if (parameters.Length == 1 &&
+          parameters[0].ParameterType == typeof(bool) &&
+          constructorInfo.GetCustomAttributes(typeof(StorableConstructorAttribute), false).Length == 1) {
+        typeDescriptor.HasStorableConstructor = true;
+        typeDescriptor.StorableConstructor = constructorInfo;
+      }
+    }
+
+    private static void MaybeAddField(FieldInfo fieldInfo, TypeDescriptor typeDescriptor, StorableClassAttribute classAttribute) {
+      if (classAttribute == null) {
+        if (IsMutableField(fieldInfo)) typeDescriptor.IsInvalid = true;
+        return;
+      }
+      if (fieldInfo.Name.StartsWith("<") || fieldInfo.Name.EndsWith("k__BackingField"))
+        return;
+      var attribute = (StorableAttribute)fieldInfo.GetCustomAttributes(typeof(StorableAttribute), false).SingleOrDefault();
+      if (attribute != null && classAttribute.Type != StorableClassType.AllProperties ||
+        classAttribute.Type == StorableClassType.AllFields ||
+        classAttribute.Type == StorableClassType.AllFieldsAndAllProperties)
+        typeDescriptor.Fields.Add(new FieldDescriptor(typeDescriptor, fieldInfo, attribute));
+    }
+
+    private static void MaybeAddProperty(PropertyInfo propertyInfo, TypeDescriptor typeDescriptor, StorableClassAttribute classAttribute) {
+      if (classAttribute == null) {
+        if (IsMutableProperty(propertyInfo)) typeDescriptor.IsInvalid = true;
+        return;
+      }
+      var attribute = (StorableAttribute)propertyInfo.GetCustomAttributes(typeof(StorableAttribute), false).SingleOrDefault();
+      if (attribute != null && classAttribute.Type != StorableClassType.AllFields ||
+        classAttribute.Type == StorableClassType.AllProperties ||
+        classAttribute.Type == StorableClassType.AllFieldsAndAllProperties) {
+        if (!(attribute != null && attribute.AllowOneWay ||
+             propertyInfo.CanRead && propertyInfo.CanWrite))
+          throw new PersistenceException("Properties have to be read/write or marked as one way storable");
+        typeDescriptor.Properties.Add(new PropertyDescriptor(typeDescriptor, propertyInfo, attribute));
+      }
+    }
+
+    private static void MaybeAddHook(MethodInfo methodInfo, TypeDescriptor typeDescriptor) {
+      if (methodInfo.ReturnType != typeof(void) || methodInfo.GetParameters().Length > 0)
+        return;
+      var attribute = (StorableHookAttribute)methodInfo.GetCustomAttributes(typeof(StorableHookAttribute), false).SingleOrDefault();
+      if (attribute != null)
+        typeDescriptor.Hooks.Add(new HookDescriptor(typeDescriptor, methodInfo, attribute.HookType));
+    }
+  }
+}
Index: anches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableMemberInfo.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableMemberInfo.cs	(revision 6213)
+++ 	(revision )
@@ -1,80 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Reflection;
-using System.Text;
-using HeuristicLab.Persistence.Core;
-
-namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable {
-
-  internal sealed class StorableMemberInfo {
-    public MemberInfo MemberInfo { get; private set; }
-    public string DisentangledName { get; private set; }
-    public object DefaultValue { get; private set; }
-    public string FullyQualifiedMemberName {
-      get {
-        return new StringBuilder()
-          .Append(MemberInfo.ReflectedType.FullName)
-          .Append('.')
-          .Append(MemberInfo.Name)
-          .ToString();
-      }
-    }
-    public StorableMemberInfo(StorableAttribute attribute, MemberInfo memberInfo) {
-      DisentangledName = attribute.Name;
-      DefaultValue = attribute.DefaultValue;
-      MemberInfo = memberInfo;
-      if (!attribute.AllowOneWay)
-        CheckPropertyAccess(memberInfo as PropertyInfo);
-    }
-    public StorableMemberInfo(MemberInfo memberInfo, bool allowOneWay) {
-      MemberInfo = memberInfo;
-      if (!allowOneWay)
-        CheckPropertyAccess(memberInfo as PropertyInfo);
-    }
-    private static void CheckPropertyAccess(PropertyInfo propertyInfo) {
-      if (propertyInfo == null)
-        return;
-      if (!propertyInfo.CanRead || !propertyInfo.CanWrite)
-        throw new PersistenceException("Properties must be readable and writable or explicity enable one way serialization.");
-    }
-    public void SetDisentangledName(string name) {
-      if (DisentangledName == null)
-        DisentangledName = name;
-    }
-    /// <summary>
-    /// Gets the type who first defined this property in the class hierarchy when the
-    /// property has subsequently been overridden but not shadowed with <code>new</code>.
-    /// </summary>
-    /// <returns>The properties base type.</returns>
-    public Type GetPropertyDeclaringBaseType() {
-      PropertyInfo pi = MemberInfo as PropertyInfo;
-      if (pi == null)
-        throw new PersistenceException("fields don't have a declaring base type, directly use FullyQualifiedMemberName instead");
-      if (pi.CanRead)
-        return pi.GetGetMethod(true).GetBaseDefinition().DeclaringType;
-      if (pi.CanWrite)
-        return pi.GetSetMethod(true).GetBaseDefinition().DeclaringType;
-      throw new InvalidOperationException("property has neigher a getter nor a setter.");
-    }
-  }
-}
Index: anches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableReflection.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableReflection.cs	(revision 6213)
+++ 	(revision )
@@ -1,223 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using HeuristicLab.Persistence.Core;
-
-namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable {
-
-  internal static class StorableReflection {
-
-    private const BindingFlags DECLARED_INSTANCE_MEMBERS =
-      BindingFlags.Instance |
-      BindingFlags.Public |
-      BindingFlags.NonPublic |
-      BindingFlags.DeclaredOnly;
-
-    public delegate void Hook(object o);
-
-    public static IEnumerable<StorableMemberInfo> GenerateStorableMembers(Type type) {
-      var storableMembers = new List<StorableMemberInfo>();
-      if (type.BaseType != null)
-        storableMembers.AddRange(GenerateStorableMembers(type.BaseType));
-
-      var storableClassAttribute = GetStorableClassAttribute(type);
-      if (storableClassAttribute != null) {
-        switch (storableClassAttribute.Type) {
-          case StorableClassType.MarkedOnly:
-            AddMarkedMembers(type, storableMembers); break;
-          case StorableClassType.AllFields:
-            AddAll(type, MemberTypes.Field, storableMembers); break;
-          case StorableClassType.AllProperties:
-            AddAll(type, MemberTypes.Property, storableMembers); break;
-          case StorableClassType.AllFieldsAndAllProperties:
-            AddAll(type, MemberTypes.Field | MemberTypes.Property, storableMembers); break;
-          default:
-            throw new PersistenceException("unsupported [StorableClassType]: " + storableClassAttribute.Type);
-        }
-      }
-      return DisentangleNameMapping(storableMembers);
-    }
-
-    public static bool IsEmptyOrStorableType(Type type, bool recursive) {
-      if (!HasStorableClassAttribute(type) && !IsEmptyType(type, false)) return false;
-      return !recursive || type.BaseType == null || IsEmptyOrStorableType(type.BaseType, true);
-    }
-
-    private static object[] emptyArgs = new object[0];
-
-    public static IEnumerable<Hook> CollectHooks(HookType hookType, Type type) {
-      if (type.BaseType != null)
-        foreach (var hook in CollectHooks(hookType, type.BaseType))
-          yield return hook;
-      if (HasStorableClassAttribute(type)) {
-        foreach (MethodInfo methodInfo in type.GetMethods(DECLARED_INSTANCE_MEMBERS)) {
-          if (methodInfo.ReturnType == typeof(void) && methodInfo.GetParameters().Length == 0) {
-            foreach (StorableHookAttribute hook in methodInfo.GetCustomAttributes(typeof(StorableHookAttribute), false)) {
-              if (hook != null && hook.HookType == hookType) {
-                yield return CreateHook(methodInfo);
-              }
-            }
-          }
-        }
-      }
-    }
-
-    private static Hook CreateHook(MethodInfo methodInfo) {
-      return new Hook((o) => methodInfo.Invoke(o, emptyArgs));
-    }
-
-    #region [Storable] helpers
-
-    private static void AddMarkedMembers(Type type, List<StorableMemberInfo> storableMembers) {
-      foreach (MemberInfo memberInfo in type.GetMembers(DECLARED_INSTANCE_MEMBERS)) {
-        if (memberInfo.MemberType == MemberTypes.Field ||
-          memberInfo.MemberType == MemberTypes.Property) {
-          foreach (StorableAttribute attribute in memberInfo.GetCustomAttributes(typeof(StorableAttribute), false)) {
-            storableMembers.Add(new StorableMemberInfo(attribute, memberInfo));
-          }
-        }
-      }
-    }
-
-    private static void AddAll(Type type, MemberTypes memberTypes, List<StorableMemberInfo> storableMembers) {
-      foreach (MemberInfo memberInfo in type.GetMembers(DECLARED_INSTANCE_MEMBERS)) {
-        if ((memberInfo.MemberType & memberTypes) == memberInfo.MemberType &&
-            !memberInfo.Name.StartsWith("<") &&
-            !memberInfo.Name.EndsWith("k__BackingField"))
-          storableMembers.Add(new StorableMemberInfo(memberInfo, false));
-      }
-    }
-
-    /// <summary>
-    /// Ascertain distinct names for all fields and properties. This method takes care
-    /// of disentangling equal names from different class hiarachy levels.
-    /// 
-    /// Field names are replaced with their fully qualified name which includes
-    /// the class names where they were declared.
-    /// 
-    /// Property names are first reduced to unqiue accessors that are not overrides of
-    /// each other and the replaced with their fully qualified name if more than one
-    /// accessor remains.
-    /// </summary>
-    /// <param name="storableMemberInfos"></param>
-    /// <returns></returns>
-    private static IEnumerable<StorableMemberInfo> DisentangleNameMapping(
-        IEnumerable<StorableMemberInfo> storableMemberInfos) {
-      var nameGrouping = new Dictionary<string, List<StorableMemberInfo>>();
-      foreach (StorableMemberInfo storable in storableMemberInfos) {
-        if (!nameGrouping.ContainsKey(storable.MemberInfo.Name))
-          nameGrouping[storable.MemberInfo.Name] = new List<StorableMemberInfo>();
-        nameGrouping[storable.MemberInfo.Name].Add(storable);
-      }
-      var memberInfos = new List<StorableMemberInfo>();
-      foreach (var storableMemberInfoGroup in nameGrouping.Values) {
-        if (storableMemberInfoGroup.Count == 1) {
-          storableMemberInfoGroup[0].SetDisentangledName(storableMemberInfoGroup[0].MemberInfo.Name);
-          memberInfos.Add(storableMemberInfoGroup[0]);
-        } else if (storableMemberInfoGroup[0].MemberInfo.MemberType == MemberTypes.Field) {
-          foreach (var storableMemberInfo in storableMemberInfoGroup) {
-            storableMemberInfo.SetDisentangledName(storableMemberInfo.FullyQualifiedMemberName);
-            memberInfos.Add(storableMemberInfo);
-          }
-        } else {
-          memberInfos.AddRange(MergePropertyAccessors(storableMemberInfoGroup));
-        }
-      }
-      return memberInfos;
-    }
-
-    /// <summary>
-    /// Merges property accessors that are overrides of each other but differentiates if a new
-    /// property that shadows older implementations has been introduced with <code>new</code>.
-    /// </summary>
-    /// <param name="members">A list of <code>StorableMemberInfo</code>s for properties of the same type.</param>
-    /// <returns>A fieltered <code>IEnumerable</code> of propery infos.</returns>
-    private static IEnumerable<StorableMemberInfo> MergePropertyAccessors(List<StorableMemberInfo> members) {
-      var uniqueAccessors = new Dictionary<Type, StorableMemberInfo>();
-      foreach (var member in members)
-        uniqueAccessors[member.GetPropertyDeclaringBaseType()] = member;
-      if (uniqueAccessors.Count == 1) {
-        var storableMemberInfo = uniqueAccessors.Values.First();
-        storableMemberInfo.SetDisentangledName(storableMemberInfo.MemberInfo.Name);
-        yield return storableMemberInfo;
-      } else {
-        foreach (var attribute in uniqueAccessors.Values) {
-          attribute.SetDisentangledName(attribute.FullyQualifiedMemberName);
-          yield return attribute;
-        }
-      }
-    }
-
-    #endregion
-
-    #region [StorableClass] helpers
-
-    private static StorableClassAttribute GetStorableClassAttribute(Type type) {
-      lock (storableClassCache) {
-        if (storableClassCache.ContainsKey(type))
-          return storableClassCache[type];
-        StorableClassAttribute attribute = type
-          .GetCustomAttributes(typeof(StorableClassAttribute), false)
-          .SingleOrDefault() as StorableClassAttribute;
-        storableClassCache.Add(type, attribute);
-        return attribute;
-      }
-    }
-
-    public static bool HasStorableClassAttribute(Type type) {
-      return GetStorableClassAttribute(type) != null;
-    }
-
-    private static Dictionary<Type, StorableClassAttribute> storableClassCache =
-      new Dictionary<Type, StorableClassAttribute>();
-
-    #endregion
-
-    #region other helpers
-
-    private static bool IsEmptyType(Type type, bool recursive) {
-      foreach (MemberInfo memberInfo in type.GetMembers(DECLARED_INSTANCE_MEMBERS)) {
-        if (IsModifiableMember(memberInfo)) return false;
-      }
-      return !recursive || type.BaseType == null || IsEmptyType(type.BaseType, true);
-    }
-
-    private static bool IsModifiableMember(MemberInfo memberInfo) {
-      return memberInfo.MemberType == MemberTypes.Field && IsModifiableField((FieldInfo)memberInfo) ||
-             memberInfo.MemberType == MemberTypes.Property && IsModifiableProperty((PropertyInfo)memberInfo);
-    }
-
-    private static bool IsModifiableField(FieldInfo fi) {
-      return !fi.IsLiteral && !fi.IsInitOnly;
-    }
-
-    private static bool IsModifiableProperty(PropertyInfo pi) {
-      return pi.CanWrite;
-    }
-
-    #endregion
-
-  }
-}
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs	(revision 6213)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs	(revision 6214)
@@ -24,7 +24,7 @@
 using System.Linq;
 using System.Reflection;
-using System.Reflection.Emit;
 using System.Text;
 using HeuristicLab.Persistence.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors;
 using HeuristicLab.Persistence.Interfaces;
 
@@ -41,10 +41,10 @@
   public sealed class StorableSerializer : ICompositeSerializer {
 
+    private StorableClassAnalyzer analyzer;
+
     public StorableSerializer() {
-      accessorListCache = new AccessorListCache();
-      accessorCache = new AccessorCache();
-      constructorCache = new Dictionary<Type, Constructor>();
-      hookCache = new Dictionary<HookDesignator, List<StorableReflection.Hook>>();
+      analyzer = new StorableClassAnalyzer();
     }
+
     [StorableConstructor]
     private StorableSerializer(bool deserializing) : this() { }
@@ -68,16 +68,15 @@
     /// </returns>
     public bool CanSerialize(Type type) {
-      bool markedStorable = StorableReflection.HasStorableClassAttribute(type);
-      if (GetConstructor(type) == null)
-        if (markedStorable)
-          throw new Exception("[Storable] type has no default constructor and no [StorableConstructor]");
+      TypeDescriptor desc = analyzer[type];
+      if (desc.IsInvalid)
+        return false;
+      if (desc.HasDefaultConstructor)
+        return true;
+      else if (desc.IsStorableClass)
+        if (desc.HasDefaultConstructor || desc.HasStorableConstructor)
+          return true;
         else
-          return false;
-      if (!StorableReflection.IsEmptyOrStorableType(type, true))
-        if (markedStorable)
-          throw new Exception("[Storable] type has non emtpy, non [Storable] base classes");
-        else
-          return false;
-      return true;
+          throw new PersistenceException("[Storable] type has no default constructor and no [StorableConstructor]");
+      return false;
     }
 
@@ -92,8 +91,13 @@
     public string JustifyRejection(Type type) {
       StringBuilder sb = new StringBuilder();
-      if (GetConstructor(type) == null)
-        sb.Append("class has no default constructor and no [StorableConstructor]");
-      if (!StorableReflection.IsEmptyOrStorableType(type, true))
-        sb.Append("class (or one of its bases) is not empty and not marked [Storable]; ");
+      TypeDescriptor desc = analyzer[type];
+      if (desc.IsInvalid)
+        sb.Append("class is not marked [StorableClass] but has mutable members.");
+      if (!desc.IsStorableClass)
+        sb.Append("class is not marked [StorableClass]");
+      if (!desc.HasDefaultConstructor)
+        sb.Append("class has no default constructor");
+      if (!desc.HasStorableConstructor)
+        sb.Append("class has no [StorableConstructor]");
       return sb.ToString();
     }
@@ -105,5 +109,4 @@
     /// <returns>A list of storable components.</returns>
     public IEnumerable<Tag> CreateMetaInfo(object o) {
-      InvokeHook(HookType.BeforeSerialization, o);
       return new Tag[] { };
     }
@@ -117,7 +120,6 @@
     /// <returns>An enumerable of <see cref="Tag"/>s.</returns>
     public IEnumerable<Tag> Decompose(object obj) {
-      foreach (var accessor in GetStorableAccessors(obj.GetType())) {
-        if (accessor.Get != null)
-          yield return new Tag(accessor.Name, accessor.Get(obj));
+      foreach (var kvp in analyzer[obj.GetType()].Decompose(obj)) {
+        yield return new Tag(kvp.Key, kvp.Value);
       }
     }
@@ -131,5 +133,5 @@
     public object CreateInstance(Type type, IEnumerable<Tag> metaInfo) {
       try {
-        return GetConstructor(type)();
+        return analyzer[type].CreateInstance();
       } catch (TargetInvocationException x) {
         throw new PersistenceException(
@@ -146,143 +148,9 @@
     /// <param name="type">The type.</param>
     public void Populate(object instance, IEnumerable<Tag> objects, Type type) {
-      var memberDict = new Dictionary<string, Tag>();
-      IEnumerator<Tag> iter = objects.GetEnumerator();
-      while (iter.MoveNext()) {
-        memberDict.Add(iter.Current.Name, iter.Current);
-      }
-      foreach (var accessor in GetStorableAccessors(instance.GetType())) {
-        if (accessor.Set != null) {
-          if (memberDict.ContainsKey(accessor.Name)) {
-            accessor.Set(instance, memberDict[accessor.Name].Value);
-          } else if (accessor.DefaultValue != null) {
-            accessor.Set(instance, accessor.DefaultValue);
-          }
-        }
-      }
-      InvokeHook(HookType.AfterDeserialization, instance);
+      analyzer[type].Populate(instance, objects.ToDictionary(kvp => kvp.Name, kvp => kvp.Value));
     }
 
     #endregion
 
-    #region constants & private data types
-
-    private const BindingFlags ALL_CONSTRUCTORS =
-      BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
-
-    private static readonly object[] emptyArgs = new object[] { };
-    private static readonly object[] trueArgs = new object[] { true };
-
-    private sealed class HookDesignator {
-      public Type Type { get; private set; }
-      public HookType HookType { get; private set; }
-      public HookDesignator() { }
-      public HookDesignator(Type type, HookType hookType) {
-        Type = type;
-        HookType = HookType;
-      }
-    }
-
-    private sealed class AccessorListCache : Dictionary<Type, IEnumerable<DataMemberAccessor>> { }
-    private sealed class AccessorCache : Dictionary<MemberInfo, DataMemberAccessor> { }
-    private delegate object Constructor();
-
-    #endregion
-
-    #region caches
-
-    private AccessorListCache accessorListCache;
-    private AccessorCache accessorCache;
-    private Dictionary<Type, Constructor> constructorCache;
-    private Dictionary<HookDesignator, List<StorableReflection.Hook>> hookCache;
-
-    #endregion
-
-    #region attribute access
-
-    private IEnumerable<DataMemberAccessor> GetStorableAccessors(Type type) {
-      lock (accessorListCache) {
-        if (accessorListCache.ContainsKey(type))
-          return accessorListCache[type];
-        var storableMembers = StorableReflection
-          .GenerateStorableMembers(type)
-          .Select(mi => GetMemberAccessor(mi));
-        accessorListCache[type] = storableMembers;
-        return storableMembers;
-      }
-    }
-
-    private DataMemberAccessor GetMemberAccessor(StorableMemberInfo mi) {
-      lock (accessorCache) {
-        if (accessorCache.ContainsKey(mi.MemberInfo))
-          return new DataMemberAccessor(accessorCache[mi.MemberInfo], mi.DisentangledName, mi.DefaultValue);
-        DataMemberAccessor dma = new DataMemberAccessor(mi.MemberInfo, mi.DisentangledName, mi.DefaultValue);
-        accessorCache[mi.MemberInfo] = dma;
-        return dma;
-      }
-    }
-
-    private Constructor GetConstructor(Type type) {
-      lock (constructorCache) {
-        if (constructorCache.ContainsKey(type))
-          return constructorCache[type];
-        Constructor c = FindStorableConstructor(type) ?? GetDefaultConstructor(type);
-        constructorCache.Add(type, c);
-        return c;
-      }
-    }
-
-    private Constructor GetDefaultConstructor(Type type) {
-      ConstructorInfo ci = type.GetConstructor(ALL_CONSTRUCTORS, null, Type.EmptyTypes, null);
-      if (ci == null)
-        return null;
-      DynamicMethod dm = new DynamicMethod("", typeof(object), null, type, true);
-      ILGenerator ilgen = dm.GetILGenerator();
-      ilgen.Emit(OpCodes.Newobj, ci);
-      ilgen.Emit(OpCodes.Ret);
-      return (Constructor)dm.CreateDelegate(typeof(Constructor));
-    }
-
-    private Constructor FindStorableConstructor(Type type) {
-      foreach (ConstructorInfo ci in type.GetConstructors(ALL_CONSTRUCTORS)) {
-        if (ci.GetCustomAttributes(typeof(StorableConstructorAttribute), false).Length > 0) {
-          if (ci.GetParameters().Length != 1 ||
-              ci.GetParameters()[0].ParameterType != typeof(bool))
-            throw new PersistenceException("StorableConstructor must have exactly one argument of type bool");
-          DynamicMethod dm = new DynamicMethod("", typeof(object), null, type, true);
-          ILGenerator ilgen = dm.GetILGenerator();
-          ilgen.Emit(OpCodes.Ldc_I4_1); // load true
-          ilgen.Emit(OpCodes.Newobj, ci);
-          ilgen.Emit(OpCodes.Ret);
-          return (Constructor)dm.CreateDelegate(typeof(Constructor));
-        }
-      }
-      return null;
-    }
-
-    private void InvokeHook(HookType hookType, object obj) {
-      if (obj == null)
-        throw new ArgumentNullException("Cannot invoke hooks on null");
-      foreach (StorableReflection.Hook hook in GetHooks(hookType, obj.GetType())) {
-        hook(obj);
-      }
-    }
-
-    private IEnumerable<StorableReflection.Hook> GetHooks(HookType hookType, Type type) {
-      lock (hookCache) {
-        List<StorableReflection.Hook> hooks;
-        var designator = new HookDesignator(type, hookType);
-        hookCache.TryGetValue(designator, out hooks);
-        if (hooks != null)
-          return hooks;
-        hooks = new List<StorableReflection.Hook>(StorableReflection.CollectHooks(hookType, type));
-        hookCache.Add(designator, hooks);
-        return hooks;
-      }
-    }
-
-    #endregion
-
-
-
   }
 
Index: /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj
===================================================================
--- /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj	(revision 6213)
+++ /branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj	(revision 6214)
@@ -138,4 +138,11 @@
     <Compile Include="Default\CompositeSerializers\CompactNumberArray2StringSerializer.cs" />
     <Compile Include="Default\CompositeSerializers\ConcreteDictionarySerializer.cs" />
+    <Compile Include="Default\CompositeSerializers\Storable\Descriptors\FieldDescriptor.cs" />
+    <Compile Include="Default\CompositeSerializers\Storable\Descriptors\HookDescriptor.cs" />
+    <Compile Include="Default\CompositeSerializers\Storable\Descriptors\ITypeComponent.cs" />
+    <Compile Include="Default\CompositeSerializers\Storable\Descriptors\PropertyDescriptor.cs" />
+    <Compile Include="Default\CompositeSerializers\Storable\Descriptors\TypeDescriptor.cs" />
+    <Compile Include="Default\CompositeSerializers\Storable\Descriptors\TypeSerializationCompiler.cs" />
+    <Compile Include="Default\CompositeSerializers\Storable\StorableClassAnalyzer.cs" />
     <Compile Include="Default\CompositeSerializers\TupleSerializer.cs" />
     <Compile Include="Default\CompositeSerializers\HashSetSerializer.cs" />
@@ -147,8 +154,5 @@
     <Compile Include="Default\CompositeSerializers\NumberEnumerable2StringSerializer.cs" />
     <Compile Include="Default\CompositeSerializers\StackSerializer.cs" />
-    <Compile Include="Default\CompositeSerializers\Storable\StorableReflection.cs" />
-    <Compile Include="Default\CompositeSerializers\Storable\StorableMemberInfo.cs" />
     <Compile Include="Default\CompositeSerializers\Storable\StorableClassType.cs" />
-    <Compile Include="Core\DataMemberAccessor.cs" />
     <Compile Include="Default\CompositeSerializers\Storable\StorableClassAttribute.cs" />
     <Compile Include="Default\CompositeSerializers\Storable\StorableAttribute.cs" />
