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); }
bool CompareObjectsAcrossStates(TraitBasedObject object1, StateData state1, TraitBasedObject object2, StateData state2) { if (!object1.HasSameTraits(object2)) { return(false); } if (object1.CarrierIndex != TraitBasedObject.Unset) { if (!state1.CarrierBuffer[object1.CarrierIndex].Equals(state2.CarrierBuffer[object2.CarrierIndex])) { return(false); } } if (object1.CarriableIndex != TraitBasedObject.Unset) { if (!state1.CarriableBuffer[object1.CarriableIndex].Equals(state2.CarriableBuffer[object2.CarriableIndex])) { return(false); } } if (object1.ColoredIndex != TraitBasedObject.Unset) { if (!state1.ColoredBuffer[object1.ColoredIndex].Equals(state2.ColoredBuffer[object2.ColoredIndex])) { return(false); } } if (object1.LocalizedIndex != TraitBasedObject.Unset) { if (!state1.LocalizedBuffer[object1.LocalizedIndex].Equals(state2.LocalizedBuffer[object2.LocalizedIndex])) { return(false); } } if (object1.LockableIndex != TraitBasedObject.Unset) { if (!state1.LockableBuffer[object1.LockableIndex].Equals(state2.LockableBuffer[object2.LockableIndex])) { return(false); } } if (object1.EndIndex != TraitBasedObject.Unset) { if (!state1.EndBuffer[object1.EndIndex].Equals(state2.EndBuffer[object2.EndIndex])) { return(false); } } return(true); }
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); }