Skip to content

[LevelEditor] Extreme optimizations loading LevelData - #316

Open
MagixGames wants to merge 1 commit into
CadeEvs:LevelEditorfrom
MagixGames:commit92423_2
Open

[LevelEditor] Extreme optimizations loading LevelData#316
MagixGames wants to merge 1 commit into
CadeEvs:LevelEditorfrom
MagixGames:commit92423_2

Conversation

@MagixGames

Copy link
Copy Markdown

optimized loading it through Dictionaries and not using FirstOrDefault()
on a 180,000 long list of entities time goes from like 25 minutes to 1 minute on average
for deathstar2_01, it went from 42:55 to 1:15

optimized loading it through Dictionaries and not using FirstOrDefault() on a *180,000* long list of entities
time goes from like 25 minutes to 1 minute on average
for deathstar2_01, it went from 42:55 to 1:15

public bool IsSimulationRunning => simulation != null;
public IEnumerable<Entities.Entity> Entities
public List<Entities.Entity> Entities

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did u decide to use a list

@MagixGames MagixGames Sep 30, 2023

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idr, can probably be reverted. the performance chance would be minimal anyways because this new method has this whole part only takes like 0.6 seconds to do

}

public List<Entities.Entity> FinalEntities;
public Dictionary<Guid, int> entitiesIndexes = new Dictionary<Guid, int>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would just make this a Dictionary<Guid, Entity> tho idk if the instanceguid is even unique for all entities, probably best to have it be some hash of the class and file guid. but yeah with this u dont need the list shit and hashset for entities, still need the referenceObjects one, tho idk for what thats used

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in deathstar_01, theres only about 5k unique instanceguids with a total of 181k entities.
how the old way did it was FirstOrDefault(), meaning it would just iterate through them, so the dictionary takes the first instance of that and sets it to the index and throws out any ones after that to match its old behavior.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i know how it was before, its just the way u did it seems to be over complicated. Also i think that its not correct as well since iirc 2 entities can have the same instance guid but are not the same, u should probably check for the classguid and fileguid to get a proper unique identifier

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the old code didnt do that why should we now? theres got to have been a reason it just threw away sequential objects

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its been a while since i looked at that, but iirc it was a bug with entities loaded from different blueprints, which got fixed when using the file and class guid instead of the instance guid

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why wasnt this resolved already then? i saw in your build it had something similar to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants