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

[1.21.x] Fix perf slowdown caused by AnyHolderSet#contains #1774

Merged
merged 1 commit into from
Dec 15, 2024

Conversation

Shadows-of-Fire
Copy link
Contributor

This PR fixes a substantial performance issue caused by AnyHolderSet#contains by changing the implementation to a .get(key) call against the underlying RegistryLookup.

The prior implementation relied on iterating through every resource key in the registry and executing ResourceKey::equals. While ::equals is fast (due to it being a reference equality check), iterating entire registries is not.

@Shadows-of-Fire Shadows-of-Fire added performance Related to performance 1.21.4 Targeted at Minecraft 1.21.4 labels Dec 14, 2024
@Shadows-of-Fire Shadows-of-Fire self-assigned this Dec 14, 2024
@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Dec 14, 2024

  • Publish PR to GitHub Packages

Last commit published: fdbe299dbce270d84eceddc6f43b0498fd840378.

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name 'Maven for PR #1774' // https://github.com/neoforged/NeoForge/pull/1774
        url 'https://prmaven.neoforged.net/NeoForge/pr1774'
        content {
            includeModule('net.neoforged', 'testframework')
            includeModule('net.neoforged', 'neoforge')
        }
    }
}

MDK installation

In order to setup a MDK using the latest PR version, run the following commands in a terminal.
The script works on both *nix and Windows as long as you have the JDK bin folder on the path.
The script will clone the MDK in a folder named NeoForge-pr1774.
On Powershell you will need to remove the -L flag from the curl invocation.

mkdir NeoForge-pr1774
cd NeoForge-pr1774
curl -L https://prmaven.neoforged.net/NeoForge/pr1774/net/neoforged/neoforge/21.4.25-beta-pr-1774-anyholderset/mdk-pr1774.zip -o mdk.zip
jar xf mdk.zip
rm mdk.zip || del mdk.zip

To test a production environment, you can download the installer from here.

@TelepathicGrunt
Copy link
Contributor

Nice. Backporting to 1.21.1 might also be a good idea

@embeddedt embeddedt merged commit 14f126a into neoforged:1.21.x Dec 15, 2024
7 checks passed
@neoforged-releases
Copy link

🚀 This PR has been released as NeoForge version 21.4.24-beta.

Soaryn pushed a commit to Soaryn/EnergyHandlerPR that referenced this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.4 Targeted at Minecraft 1.21.4 performance Related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants