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

[MIRROR] Micro-Optimize keyLoop's self time #2024

Merged
merged 1 commit into from
Feb 17, 2024
Merged

Conversation

Steals-The-PRs
Copy link
Collaborator

Mirrored on Nova: NovaSector/NovaSector#969
Original PR: tgstation/tgstation#81464

About The Pull Request

This is a REALLY hot proc, takes up to like 2% of total cpu at highpop
Let's micro it then

First, clients do not go null at random. It's not predictable per say but it is consistent.
We can use this understanding to remove a bunch of null checks here

For loops are expensive. So rather then doing one each keyLoop, let's cache the client's intended move direction on the client. Simplifies some other code too

There is no sense running a turn call if it would have no effect, let's be more intelligent about this

Changelog

🆑 LemonInTheDark
refactor: Fucks with how movement keys are handled. Please report any bugs
/:cl:

* Micro-Optimize keyLoop's self time (#81464)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

This is a REALLY hot proc, takes up to like 2% of total cpu at highpop 
Let's micro it then

First, clients do not go null at random. It's not predictable per say
but it is consistent.
We can use this understanding to remove a bunch of null checks here

For loops are expensive. So rather then doing one each keyLoop, let's
cache the client's intended move direction on the client. Simplifies
some other code too

There is no sense running a turn call if it would have no effect, let's
be more intelligent about this

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

:cl:
refactor: Fucks with how movement keys are handled. Please report any
bugs
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

* Micro-Optimize keyLoop's self time

---------

Co-authored-by: LemonInTheDark <[email protected]>
@Iajret Iajret merged commit 353f01c into master Feb 17, 2024
24 checks passed
@Iajret Iajret deleted the upstream-mirror-969 branch February 17, 2024 16:21
AnywayFarus added a commit that referenced this pull request Feb 17, 2024
Iajret added a commit that referenced this pull request Apr 18, 2024
* opt-in fixes

* Apply suggestions from code review

---------

Co-authored-by: Bloop <[email protected]>
ReezeBL pushed a commit that referenced this pull request Apr 18, 2024
* opt-in fixes

* Apply suggestions from code review

---------

Co-authored-by: Iajret <[email protected]>
Co-authored-by: Bloop <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants