Inherited objects take longer to store as their parent indexes need to be updated too.
UpdatePerformanceBenchmark.cs: RunInheritanceTest private void RunInheritanceTest() { System.Console.WriteLine("Update test: objects with deep inheritance"); int objectsToUpdate = 30; Init(); Clean(); Open(Configure()); Store(); System.Console.WriteLine("Updating " + objectsToUpdate + " objects"); UpdateItems(objectsToUpdate); Close(); Clean(); Open(Configure()); StoreInherited(); System.Console.WriteLine("Updating " + objectsToUpdate + " inherited objects"); UpdateItems(objectsToUpdate); Close(); }
UpdatePerformanceBenchmark.cs: Configure private IConfiguration Configure() { IConfiguration config = Db4oFactory.NewConfiguration(); // using MemoryIoAdapter improves the performance // by replacing the costly disk IO operations with // memory access config.Io(new MemoryIoAdapter()); return config; }
UpdatePerformanceBenchmark.cs: Init private void Init() { _count = 1000; _depth = 90; _isClientServer = false; }
UpdatePerformanceBenchmark.cs: ItemDerived public class ItemDerived : Item { public ItemDerived(string name, ItemDerived child) : base(name, child) { } }
The results:
Update test: objects with deep inheritance
Store 90000 objects: 6312ms
Updating 30 objects
Updated 30 items: 272ms
Store 90000 objects: 5657ms
Updating 30 inherited objects
Updated 30 items: 436ms
Download example code: