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

Backend: Event Predicates #3417

Open
wants to merge 6 commits into
base: beta
Choose a base branch
from

Conversation

ItsEmpa
Copy link
Contributor

@ItsEmpa ItsEmpa commented Feb 10, 2025

What

This PR changes the way in which conditions are checked when invoking events, only looking at which conditions will have to be checked when the listener is first initialized, and storing the conditions as lists of lambdas. it also makes it so that conditions such as onlyOnSkyblock and onlyOnIsland(s) are only calculated once every tick, which should help with performance a bit on events that get called a lot (such as render events getting called every frame).

This PR also indirectly fixes the issue found and fixed in #3411, because it only accesses the values of the HandleEvent object once.

Did some testing while in hub 1, this is the difference i found when profiling the previous and the new shouldInvoke function was of more or less ~66%

Profiling Images

before
imagen
after
imagen

Changelog Improvements

  • Improved performance overall slightly. - Empa, Nessiesson

Changelog Technical Details

  • Changed pre-conditions of events to be cached per tick and only checked when necessary. - Empa, ThatGravyBoat

@github-actions github-actions bot added the Backend A backend pull request that will be merged soon label Feb 10, 2025
@github-actions github-actions bot added the Detekt Has detekt problem label Feb 11, 2025
Copy link

One or more Detekt Failures were detected:

@hannibal002 hannibal002 added this to the 2.0.0 milestone Feb 11, 2025
@hannibal002 hannibal002 added the Soon This Pull Request will be merged within the next couple of betas label Feb 11, 2025
Copy link
Owner

@hannibal002 hannibal002 left a comment

Choose a reason for hiding this comment

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

waiting on changes above

Signed-off-by: Empa <[email protected]>
Copy link

One or more Detekt Failures were detected:

@github-actions github-actions bot removed the Detekt Has detekt problem label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend A backend pull request that will be merged soon Soon This Pull Request will be merged within the next couple of betas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants