public static void Main(string[] args) { Lookup_ScopeManager.RegisterAll(); Thread.Sleep(500); // 1500 MemoryHelper.MemoryBegin(); R.Log("CompData"); // 1 exclude component-data-init time from test R.Run <Entity_AddRemove_CompData_Class>(); // 2 include component-data-init into test // (results can be compared with tests 3 4 5 and 11) R.Run <Entity_AddRemove_CompData_Class_AddNewInstance>(); // 3 replace component data init by Cache.I.Set // (results can be compared with tests 2 4 5 and 11) R.Run <Entity_AddRemove_CompData_Class_SetUsingCache>(); // 4 Create-Apply workflow // (results can be compared with tests 2, 3 5 and 11) R.Run <Entity_AddRemove_CompData_Class_CreateSetApply>(); // 3.2 repeat test#3 to double check stats accuracy R.Run <Entity_AddRemove_CompData_Class_SetUsingCache>(); // 10 base struct Add test R.Run <Entity_AddRemove_CompData_Struct>(); // 11 is like 10 but component initialization is included into test // so results can be compared with tests 2-5 R.Run <Entity_AddRemove_CompData_Struct_IncludeInit>(); R.Run <Entity_AddRemove_CompData_Class_WithGroups>(); R.Run <Entity_AddRemove_CompData_Struct_WithGroups>(); R.Run <Entity_Replace_CompData_Class_WithGroups>(); R.Run <Entity_Replace_CompData_Struct_WithGroups>(); R.Log("\nCompData.Get"); R.Run <Entity_Get_CompData_Class>( ); R.Run <Entity_Get_CompData_Struct>( ); R.Log("\nCompData.Has"); R.Run <Entity_Has_CompData_Class>( ); R.Run <Entity_Has_CompData_Struct>( ); R.Log("\nFlag"); R.Run <Entity_Flag_CompFlag>( ); R.Run <Entity_Is_CompFlag>( ); R.Log("\nMisc"); R.Run <Struct_ToString_Implemented>( ); R.Run <Struct_ToString_NotImplemented>( ); R.Run <Struct_ToString_ToGenericTypeString>( ); MemoryHelper.MemoryEnd( ); }
// Running performance tests... // PoolCreateEntity: 30 ms // PoolDestroyEntity: 29 ms // PoolDestroyAllEntities: 25 ms // PoolGetGroup: 5 ms // PoolGetEntities: 2 ms // PoolHasEntity: 10 ms // PoolOnEntityReplaced: 6 ms // // EntityAddComponent: 257 ms // EntityGetComponent: 44 ms // EntityGetComponents: 4 ms // EntityHasComponent: 2 ms // EntityRemoveAddComponent: 289 ms // EntityReplaceComponent: 20 ms // // MatcherEquals: 171 ms // MatcherGetHashCode: 17 ms // // NewInstanceT: 393 ms // NewInstanceActivator: 542 ms // IterateHashetToArray: 456 ms // IterateHashSet: 774 ms // // ObjectGetProperty: 6 ms // // ObserverIterateCollectedEntities: 957 ms // PropertiesCreate: 251 ms // // HashSetContainsAdd: 173 ms // ArrayGetItem: 2 ms // DictionaryGetItem: 7 ms // LinkedListAdd: 17 ms // LinkedListRemove: 4 ms // ListAdd: 14 ms // ListGetItem: 2 ms // ListRemove: 8647 ms // OrderedDictionaryAdd: 30 ms // OrderedDictionaryGetItemByIndex: 4 ms // OrderedDictionaryGetItemByKey: 4 ms // OrderedDictionaryRemove: 7 ms static void run <T>() where T : IPerformanceTest, new() { Thread.Sleep(100); if (typeof(T) == typeof(EmptyTest)) { Console.WriteLine(string.Empty); return; } Console.Write((typeof(T) + ": ").PadRight(40)); // For more reliable results, run before PerformanceTestRunner.Run(new T()); var ms = PerformanceTestRunner.Run(new T()); Console.WriteLine(ms + " ms"); }