private static long Time(IProcedure4 procedure4) { PagingMemoryStorage storage = new PagingMemoryStorage(); StoreItems(storage); StopWatch stopWatch = new AutoStopWatch(); for (int i = 0; i < Iterations; ++i) { ApplyProcedure(storage, procedure4); } return stopWatch.Peek(); }
public static void UsingPagingMemoryStorage() { // #example: Using paging memory-storage IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); PagingMemoryStorage memory = new PagingMemoryStorage(); configuration.File.Storage = memory; IObjectContainer container = Db4oEmbedded.OpenFile(configuration, "database.db4o"); // #end example container.Close(); }
private static void ApplyProcedure(PagingMemoryStorage storage, IProcedure4 procedure4 ) { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.File.Storage = storage; IEmbeddedObjectContainer container = Db4oEmbedded.OpenFile(config, "benchmark.db4o" ); try { procedure4.Apply(container); } finally { container.Close(); } }
private static void StoreItems(PagingMemoryStorage storage) { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.File.Storage = storage; IEmbeddedObjectContainer container = Db4oEmbedded.OpenFile(config, "benchmark.db4o" ); try { for (int i = 0; i < ObjectCount; ++i) { container.Store(new SodaQueryComparatorBenchmark.Item(i, "Item " + i, new SodaQueryComparatorBenchmark.ItemChild ("Child " + i))); } } finally { container.Close(); } }