Changeset 1360
- Timestamp:
- 03/19/09 12:31:19 (16 years ago)
- Location:
- branches/New Persistence Exploration/Persistence
- Files:
-
- 13 added
- 10 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New Persistence Exploration/Persistence/Persistence/HeuristicLab.Persistence.csproj
r1357 r1360 55 55 </ItemGroup> 56 56 <ItemGroup> 57 <Compile Include="ArrayFormatters.cs" /> 58 <Compile Include="EnumerableFormatters.cs" /> 57 <Compile Include="Default\NumberArrayFormatters.cs" /> 58 <Compile Include="Core\DataMemberAccessor.cs" /> 59 <Compile Include="Default\EnumerableFormatters.cs" /> 59 60 <Compile Include="HeuristicLabPersistencePlugin.cs" /> 60 <Compile Include=" DeSerializer.cs" />61 <Compile Include="Core\DeSerializer.cs" /> 61 62 <Compile Include="Interfaces\IDecomposer.cs" /> 62 63 <Compile Include="Interfaces\IFormatter.cs" /> 63 <Compile Include=" PersistenceConfiguration.cs" />64 <Compile Include="Core\PersistenceConfiguration.cs" /> 64 65 <Compile Include="Properties\AssemblyInfo.cs" /> 65 <Compile Include=" Serializer.cs" />66 <Compile Include="De composers.cs" />67 <Compile Include=" PrimitiveFormatters.cs" />66 <Compile Include="Core\Serializer.cs" /> 67 <Compile Include="Default\Decomposers.cs" /> 68 <Compile Include="Default\PrimitiveFormatters.cs" /> 68 69 <Compile Include="Interfaces\Tokens.cs" /> 69 70 <Compile Include="Util.cs" /> 70 <Compile Include=" StorableAttribute.cs" />71 <Compile Include=" XmlFormatter.cs" />72 <Compile Include=" XmlParser.cs" />71 <Compile Include="Core\StorableAttribute.cs" /> 72 <Compile Include="Default\XmlFormatter.cs" /> 73 <Compile Include="Default\XmlParser.cs" /> 73 74 </ItemGroup> 74 75 <PropertyGroup> -
branches/New Persistence Exploration/Persistence/Persistence/Interfaces/IDecomposer.cs
r1357 r1360 5 5 6 6 public interface IDecomposer { 7 bool Can Serialize(Type type);8 IEnumerable Serialize(object obj);9 object DeSerialize(IEnumerable objects, Type type);7 bool CanDecompose(Type type); 8 IEnumerable DeCompose(object obj); 9 object Compose(IEnumerable objects, Type type); 10 10 } 11 11 -
branches/New Persistence Exploration/Persistence/Persistence/Interfaces/IFormatter.cs
r1357 r1360 10 10 Type Type { get; } 11 11 IFormat Format { get; } 12 object Serialize(object o);13 object DeSerialize(object o);12 object DoFormat(object o); 13 object Parse(object o); 14 14 } 15 15 -
branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs
r1358 r1360 3 3 using System.Collections.Generic; 4 4 using System.IO; 5 using HeuristicLab.Persistence.Core; 5 6 using HeuristicLab.Persistence.Interfaces; 6 7 … … 172 173 XmlParser.ParseTypeCache(new StreamReader("test-types.xml")), 173 174 ConfigurationService.Instance.GetDefaultConfig(XmlFormat.Instance)); 174 object o = deSerializer.DeSerialize(parser); 175 Root t = CloningFactory.DefaultClone(r); 175 object o = deSerializer.DeSerialize(parser); 176 176 Console.Out.WriteLine(Util.AutoFormat(o, true)); 177 177 } … … 193 193 XmlParser.ParseTypeCache(new StreamReader("test-types.xml")), 194 194 ConfigurationService.Instance.GetDefaultConfig(XmlFormat.Instance)); 195 object o = deSerializer.DeSerialize(parser); 196 Manager n = CloningFactory.DefaultClone(m); 195 object o = deSerializer.DeSerialize(parser); 197 196 Console.Out.WriteLine(Util.AutoFormat(o, true)); 198 } 199 200 public static void SpeedTest() { 201 StorableObject storable = new StorableObject(); 202 CloneableObject cloneable = new CloneableObject(); 203 Console.Write("initializing..."); 204 storable.Init(); 205 cloneable.Init(); 206 Console.WriteLine("done"); 207 List<StorableObject> storableClones = new List<StorableObject>(); 208 List<CloneableObject> clonableClones = new List<CloneableObject>(); 209 CloningFactory cloningFactory = new CloningFactory(); 210 for (int i = 0; i < 100000; i++) { 211 Console.Write("cloning storable.. "); 212 storableClones.Add(cloningFactory.Clone(storable)); 213 Console.WriteLine(); 214 Console.Write("cloning cloneable.. "); 215 clonableClones.Add((CloneableObject)cloneable.Clone()); 216 Console.WriteLine(); 217 } 218 } 219 220 public static void SpeedTest2() { 221 Root r = new Root(); 222 r.selfReferences = new List<Root> {r, r}; 223 r.c = new Custom {r = r}; 224 r.dict.Add("one", 1); 225 r.dict.Add("two", 2); 226 r.dict.Add("three", 3); 227 228 CloneableRoot cr = new CloneableRoot(); 229 cr.selfReferences = new List<CloneableRoot> {cr, cr}; 230 cr.c = new CloneableCustom {r = cr}; 231 cr.dict.Add("one", 1); 232 cr.dict.Add("two", 2); 233 cr.dict.Add("three", 3); 234 List<Root> storableClones = new List<Root>(); 235 List<CloneableRoot> clonableClones = new List<CloneableRoot>(); 236 CloningFactory cloningFactory = new CloningFactory(); 237 238 DateTime start = DateTime.Now; 239 Console.Write("cloning storable.. "); 240 for (int i = 0; i < 100000; i++) { 241 storableClones.Add(cloningFactory.Clone(r)); 242 } 243 Console.WriteLine(new TimeSpan(DateTime.Now.Ticks - start.Ticks)); 244 245 start = DateTime.Now; 246 Console.Write("cloning storable again.. "); 247 for (int i = 0; i < 100000; i++) { 248 storableClones.Add(cloningFactory.Clone(r)); 249 } 250 Console.WriteLine(new TimeSpan(DateTime.Now.Ticks - start.Ticks)); 251 252 start = DateTime.Now; 253 Console.Write("cloning cloneable.. "); 254 for (int i = 0; i < 100000; i++) { 255 clonableClones.Add((CloneableRoot)cr.Clone(new Dictionary<object, object>())); 256 } 257 Console.WriteLine(new TimeSpan(DateTime.Now.Ticks - start.Ticks)); 258 clonableClones.Clear(); 259 260 } 197 } 261 198 262 199 public class Base { -
branches/New Persistence Exploration/Persistence/Test/StorableAttributeTests.cs
r1357 r1360 1 1 using System; 2 2 using System.Collections.Generic; 3 using HeuristicLab.Persistence.Core; 3 4 4 5 namespace HeuristicLab.Persistence.Test {
Note: See TracChangeset
for help on using the changeset viewer.