Skip to content

Reduce lag when panning zoomed-out galactic map#1

Open
ritikmishra wants to merge 2 commits intokronosaur:masterfrom
ritikmishra:fix-laggy-drag
Open

Reduce lag when panning zoomed-out galactic map#1
ritikmishra wants to merge 2 commits intokronosaur:masterfrom
ritikmishra:fix-laggy-drag

Conversation

@ritikmishra
Copy link
Copy Markdown

The cause of the lag

To draw empire names under capital worlds when the map is zoomed out, $GalacticMap.onDraw iterates through a list through all sovereigns playing the game. However, despite only having ~250 non-null elements, the list is ~3.9 million items long because the array is indexed by the sovereign ID.

The solution

By using an object instead of an array, the time spent drawing sovereign names is reduced.

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.

1 participant