public void TestRemoveFirstObjectTrait500Rooms()
        {
            StateData        stateData        = default;
            TraitBasedObject traitBasedObject = default;

            Measure.Method(() =>
            {
                stateData.RemoveTraitOnObject <Colored>(ref traitBasedObject);
            }).SetUp(() =>
            {
                stateData = m_StateManager.CopyStateData(m_LargeStateData);
                for (int i = 0; i < stateData.TraitBasedObjects.Length; i++)
                {
                    traitBasedObject = stateData.TraitBasedObjects[i];
                    var coloredIndex = traitBasedObject.ColoredIndex;

                    if (coloredIndex != TraitBasedObject.Unset)
                    {
                        break;
                    }
                }
            }).WarmupCount(1).MeasurementCount(30).IterationsPerMeasurement(1).Run();

            PerformanceUtility.AssertRange(0.05, 0.075);
        }
        public void TestStateCopying500Rooms()
        {
            var stateData = m_LargeStateData;

            Measure.Method(() =>
            {
                m_StateManager.CopyStateData(stateData);
            }).WarmupCount(1).MeasurementCount(30).IterationsPerMeasurement(1).Run();

            PerformanceUtility.AssertRange(0.02, 0.06);
        }
        public void TestStateEquality500Rooms()
        {
            var  originalStateData = m_LargeStateData;
            var  stateCopy         = m_StateManager.CopyStateData(originalStateData);
            bool areEqual          = true;

            Measure.Method(() =>
            {
                areEqual &= originalStateData.Equals(stateCopy);
            }).WarmupCount(1).MeasurementCount(30).IterationsPerMeasurement(1).Run();

            Assert.IsTrue(areEqual);

            PerformanceUtility.AssertRange(0.32, 0.46);
        }
        public void TestRemoveLastObjectTrait500Rooms()
        {
            StateData        stateData        = default;
            TraitBasedObject traitBasedObject = default;

            Measure.Method(() =>
            {
                stateData.RemoveTraitOnObject <Colored>(ref traitBasedObject);
            }).SetUp(() =>
            {
                stateData        = m_StateManager.CopyStateData(m_LargeStateData);
                traitBasedObject = stateData.TraitBasedObjects[stateData.TraitBasedObjects.Length - 1];
            }).WarmupCount(1).MeasurementCount(30).IterationsPerMeasurement(1).Run();

            PerformanceUtility.AssertRange(0.16, 0.19);
        }
        public void TestRemoveFirstObject500Rooms()
        {
            StateData        stateData        = default;
            TraitBasedObject traitBasedObject = default;

            Measure.Method(() =>
            {
                stateData.RemoveObject(traitBasedObject);
            }).SetUp(() =>
            {
                stateData        = m_StateManager.CopyStateData(m_LargeStateData);
                traitBasedObject = stateData.TraitBasedObjects[0];
            }).WarmupCount(1).MeasurementCount(30).IterationsPerMeasurement(1).Run();

            PerformanceUtility.AssertRange(0.11, 0.145);
        }
        public void TestObjectFiltering500Rooms()
        {
            StateData stateData = default;
            var       objects   = new NativeList <int>(Allocator.Temp);
            var       types     = new NativeArray <ComponentType>(2, Allocator.TempJob)
            {
                [0] = ComponentType.ReadWrite <Colored>(), [1] = ComponentType.ReadWrite <Lockable>()
            };

            Measure.Method(() =>
            {
                stateData.GetTraitBasedObjectIndices(objects, types);
            }).SetUp(() =>
            {
                stateData = m_StateManager.CopyStateData(m_LargeStateData);
                objects.Clear();
            }).WarmupCount(1).MeasurementCount(30).IterationsPerMeasurement(1).Run();

            types.Dispose();
            objects.Dispose();

            PerformanceUtility.AssertRange(0.11, 0.19);
        }