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

Improve hasErrors implementations #159

Merged
merged 2 commits into from
Jun 3, 2024
Merged

Conversation

embeddedt
Copy link
Member

This PR fixes an issue where LoadingModList.hasErrors incorrectly returns true if there are actually no loading errors. The original logic of this method appears to be backwards, it returns true if none of the issues have a severity of ERROR.

Additionally, I made both LoadingModList.hasErrors() and ModLoader.hasErrors() check that the list of issues is non-empty before bothering to create a stream. This avoids unnecessary stream allocations in hot code in the very common case of there being no warnings or errors, and is trivial enough that it's harmless to add.

@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jun 3, 2024

  • Publish PR to GitHub Packages

Last commit published: e000ec2cb2dcd5c18380993cdcee5cee63bb6a13.

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 #159' // https://github.com/neoforged/FancyModLoader/pull/159
        url 'https://prmaven.neoforged.net/FancyModLoader/pr159'
        content {
            includeModule('net.neoforged.fancymodloader', 'earlydisplay')
            includeModule('net.neoforged.fancymodloader', 'loader')
            includeModule('net.neoforged.fancymodloader', 'junit-fml')
        }
    }
}

@shartte
Copy link
Contributor

shartte commented Jun 3, 2024

Quick 'n dirty JMH:

Benchmark                             Mode  Cnt           Score          Error  Units
AnyMatchVsIsEmpty.withEmptyCheck     thrpt    5  1466616037.872 � 16579783.035  ops/s
AnyMatchVsIsEmpty.withoutEmptyCheck  thrpt    5   110953698.193 �  7635053.997  ops/s

@shartte shartte merged commit 1b6af92 into neoforged:main Jun 3, 2024
4 checks passed
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