public void SinglePositionUpdate() { var markers = new[] { "GatherAllChunks", "ExecuteReplication", "Position.SendUpdates", "WorkerSystem.SendMessages", "Position.ComponentSerializer.Serialize" }; var currentState = World.Step(world => { world.Connection.CreateEntity(EntityId, GetEntityTemplate()); world.Connection.ChangeAuthority(EntityId, Position.ComponentId, Authority.Authoritative); }); ActionMeasurement.Measure(() => { currentState.Step(world => { var workerSystem = world.GetSystem <WorkerSystem>(); var entity = workerSystem.GetEntity(new EntityId(EntityId)); var position = workerSystem.EntityManager.GetComponentData <Position.Component>(entity); position.Coords = new Coordinates(3006, 42, 2020); workerSystem.EntityManager.SetComponentData(entity, position); }); }) .ProfilerMarkers(markers) .WarmupCount(10) .MeasurementCount(100) .Run(); }
public void RefreshData_and_ApplySearch_with_increasing_number_of_entities(int entityCount) { var profilerMarkers = new[] { "EntityList.RefreshData", "EntityList.ApplySearch" }; var currentState = World .Step(world => { for (var i = 1; i < entityCount + 1; i++) { world.Connection.CreateEntity(i, GetTemplate("some-entity")); } }) .Step(world => { var data = new EntityListData(); data.ApplySearch(EntitySearchParameters.FromSearchString("2")); data.SetNewWorld(world.Worker.World); // Yikes return(data); }); ActionMeasurement.Measure(() => { currentState.Step((world, data) => { data.RefreshData(); return(data); }); }) .WarmupCount(3) .MeasurementCount(30) .ProfilerMarkers(profilerMarkers) .Run(); }