From 9bc6822f385f9f43c2df1ebc0b5e64ac47da8071 Mon Sep 17 00:00:00 2001
From: cosmonaut <evan@moonside.games>
Date: Wed, 7 Dec 2022 10:17:07 -0800
Subject: [PATCH] optimize snapshot

---
 src/Snapshot.cs | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/src/Snapshot.cs b/src/Snapshot.cs
index 992f121..52ec53f 100644
--- a/src/Snapshot.cs
+++ b/src/Snapshot.cs
@@ -50,18 +50,6 @@ namespace MoonTools.ECS
 				{
 					SnapshotEntityStorage.AddRelationKind(snapshotEntityID, relationTypeIndex);
 
-					foreach (var (otherEntityID, relationData) in World.RelationDepot.InRelations(worldEntity.ID, relationTypeIndex))
-					{
-#if DEBUG
-						if (!World.FilterStorage.CheckSatisfied(otherEntityID, Filter.Signature))
-						{
-							throw new InvalidOperationException($"Snapshot entity {worldEntity.ID} is related to non-snapshot entity {otherEntityID}!");
-						}
-#endif
-						var otherSnapshotID = WorldToSnapshotID[otherEntityID];
-						SnapshotRelationDepot.Set(otherSnapshotID, snapshotEntityID, relationTypeIndex, relationData);
-					}
-
 					foreach (var (otherEntityID, relationData) in World.RelationDepot.OutRelations(worldEntity.ID, relationTypeIndex))
 					{
 #if DEBUG
@@ -71,6 +59,7 @@ namespace MoonTools.ECS
 						}
 #endif
 						var otherSnapshotID = WorldToSnapshotID[otherEntityID];
+						SnapshotEntityStorage.AddRelationKind(otherSnapshotID, relationTypeIndex);
 						SnapshotRelationDepot.Set(snapshotEntityID, otherSnapshotID, relationTypeIndex, relationData);
 					}
 				}
@@ -110,12 +99,6 @@ namespace MoonTools.ECS
 				{
 					World.EntityStorage.AddRelationKind(worldID, relationTypeIndex);
 
-					foreach (var (otherEntityID, relationData) in SnapshotRelationDepot.InRelations(i, relationTypeIndex))
-					{
-						var otherEntityWorldID = SnapshotToWorldID[otherEntityID];
-						World.RelationDepot.Set(otherEntityWorldID, worldID, relationTypeIndex, relationData);
-					}
-
 					foreach (var (otherEntityID, relationData) in SnapshotRelationDepot.OutRelations(i, relationTypeIndex))
 					{
 						var otherEntityWorldID = SnapshotToWorldID[otherEntityID];