Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task] Low hanging UI performance fruits #520

Closed
kvakvs opened this issue Sep 6, 2019 · 4 comments · Fixed by #521
Closed

[Task] Low hanging UI performance fruits #520

kvakvs opened this issue Sep 6, 2019 · 4 comments · Fixed by #521
Assignees
Labels
code cleanup Refactor code, remove old code, improve maintainability LANE ROUTING Feature: Lane arrows / connectors Overlays Overlays, data vis, etc. PARKING Feature: Parking AI / restrictions / etc performance Make it faster! SPEED LIMITS Feature: Speed limits UI User interface updates
Milestone

Comments

@kvakvs
Copy link
Collaborator

kvakvs commented Sep 6, 2019

Describe your idea

For tools which edit nodes and segments, add code to cache the visible nodes and segments and not recalculate them until the camera moves.

For speed limit tool apply similar improvement
[17:32] aubergine18: when the main speed limit tool is active, it iterates all segments, and for each one does a big bunch of checks to see if it's visible, if it can handle speed limits, etc
[17:32] aubergine18: well, if cached, yes, it would be one time only
[17:32] aubergine18: but it's not currently cached from what I can see

@kvakvs kvakvs added enhancement Improve existing feature feature A new distinct feature labels Sep 6, 2019
@kvakvs kvakvs self-assigned this Sep 6, 2019
@kvakvs kvakvs added this to To do in Make TM:PE Great Sep 6, 2019
@originalfoo
Copy link
Member

originalfoo commented Sep 6, 2019

Actually, looking at code again, there is some degree of caching I think - currentlyVisibleSegmentIds

https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/blob/master/TLM/TLM/UI/SubTools/SpeedLimits/SpeedLimitsTool.cs#L146-L152

EDIT; I don't know if other tools do the same

@Strdate
Copy link

Strdate commented Sep 6, 2019

I was copying some TMPE code for my own mod and yes, the signs were cached (in particular parking signs)

@kvakvs
Copy link
Collaborator Author

kvakvs commented Sep 7, 2019

First experiment:
Caching node ids while the camera is not moving, for Lane Connectors tool.
Master build (unchanged) filters all visible nodes every frame and lose 12-17ms per frame.
With cache changes nodes only re-filter when camera is moved, and that just takes 1-2 ms per frame.

@originalfoo
Copy link
Member

Here's another low fruit: https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/blob/master/TLM/TLM/UI/MainMenu/StatsLabel.cs

When the path find stats display is not active, it should not do anything. Even when it is active, it should avoid using Update() on a UI component. Ideally the UI should be disabled and not visible when not in use.

For compatibility with the FPS Booster mod, we should avoid any Update() on UI components (except panels which still retain the base method).

@originalfoo originalfoo added code cleanup Refactor code, remove old code, improve maintainability LANE ROUTING Feature: Lane arrows / connectors Overlays Overlays, data vis, etc. PARKING Feature: Parking AI / restrictions / etc performance Make it faster! SPEED LIMITS Feature: Speed limits UI User interface updates and removed feature A new distinct feature labels Sep 7, 2019
@originalfoo originalfoo added this to the 11.0 milestone Sep 7, 2019
@originalfoo originalfoo removed the enhancement Improve existing feature label Sep 7, 2019
@kvakvs kvakvs moved this from To do to Done in Make TM:PE Great Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup Refactor code, remove old code, improve maintainability LANE ROUTING Feature: Lane arrows / connectors Overlays Overlays, data vis, etc. PARKING Feature: Parking AI / restrictions / etc performance Make it faster! SPEED LIMITS Feature: Speed limits UI User interface updates
Projects
Development

Successfully merging a pull request may close this issue.

3 participants