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

[PORT] GetFlatIcon improvements #3422

Merged
merged 2 commits into from
Sep 16, 2024
Merged

Conversation

Absolucy
Copy link
Member

About The Pull Request

Port of tgstation/tgstation#86077

I've added an get_icon_dimensions() call to a place where icon.Width() and icon.Height() are called twice each. get_icon_dimensions uses a cache of values so follow-up getFlatIcon() calls with the same current icon won't have it callicon.Width() or icon.Height() which aren't exactly cheap procs iirc.

I've also removed two of the fairly expensive
length(icon_states(icon(curicon, curstate, dir))) checks, because all icon states have NORTH, EAST and WEST directions except 1-dir icon_states which are always facing SOUTH. That is, unless there is some farfetched procgenned bullshit that's probably not even possible and worth checking against. We'll see.

Why It's Good For The Game

GetFlatIcon is a very expensive proc, every bit of improvement is worth it.

Changelog

N/A

Ghommie and others added 2 commits September 15, 2024 18:42
## About The Pull Request
I've added an get_icon_dimensions() call to a place where `icon.Width()`
and `icon.Height()` are called twice each. get_icon_dimensions uses a
cache of values so follow-up getFlatIcon() calls with the same current
icon won't have it call`icon.Width()` or `icon.Height()` which aren't
exactly cheap procs iirc.

I've also removed two of the fairly expensive
`length(icon_states(icon(curicon, curstate, dir)))` checks, because all
icon states have NORTH, EAST and WEST directions except 1-dir
icon_states which are always facing SOUTH. That is, unless there is some
farfetched procgenned bullshit that's probably not even possible and
worth checking against. We'll see.

## Why It's Good For The Game
GetFlatIcon is a very expensive proc, every bit of improvement is worth
it.

## Changelog
N/A
@Absolucy Absolucy merged commit e78dd90 into Monkestation:master Sep 16, 2024
22 checks passed
@Absolucy Absolucy deleted the gfiopt branch September 16, 2024 09:52
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