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

Glyph Rendering Performance #139

Open
ghost opened this issue Mar 7, 2021 · 2 comments
Open

Glyph Rendering Performance #139

ghost opened this issue Mar 7, 2021 · 2 comments
Labels
Priority: MED This issue is of medium priority. Status: Todo This issue has been approved and needs to be completed/implemented. Type: Bug This issue contains a bug.

Comments

@ghost
Copy link

ghost commented Mar 7, 2021

While testing optimizations & profiling with a lot of other mods, I found QuickPlay to come up quite a bit due to the GlyphRenderer class.
image
The issue here is the two .stream() calls in GlyphRenderer#onRenderPlayer,
Quickplay.INSTANCE.glyphs.stream().anyMatch(glyph -> glyph.uuid.toString().equals(player.getUniqueID().toString()))

Quickplay.INSTANCE.glyphs.stream().filter(thisGlyph -> thisGlyph.uuid.equals(player.getGameProfile().getId())).collect(Collectors.toList()).get(0)

This can be easily optimized to

boolean hasGlyph = false;
for (PlayerGlyph glyph : Quickplay.INSTANCE.glyphs) {
    if (glyph.uuid.toString().equals(player.getUniqueID().toString()) {
        hasGlyph = true;
        break;
    }
}

List<PlayerGlyph> glyphList = new ArrayList<>();
for (PlayerGlyph glyph : Quickplay.INSTANCE.glyphs) {
    if (glyph.uuid.equals(player.getGameProfile().getId())) {
        glyphList.add(glyph);
    }
}

PlayerGlyph glyph = glyphList.get(0);

or something similar, just to resolve the performance issue present here, as glyph's dont seem to have the ability to toggling them, so this will run every frame for every player(?).

This profiling was done in a minute, in Lobby 1 on Skyblock.

@robere2 robere2 assigned robere2 and unassigned robere2 Mar 7, 2021
@robere2 robere2 transferred this issue from robere2/QuickPlay Mar 7, 2021
@robere2 robere2 added Priority: MED This issue is of medium priority. Status: Todo This issue has been approved and needs to be completed/implemented. Type: Bug This issue contains a bug. labels Mar 7, 2021
@robere2
Copy link
Collaborator

robere2 commented Mar 7, 2021

Do you happen to know what version this was tested on? I believe I made some optimizations in 2.1.0 beta, but this very well may still be an issue as I don't think I touched that exact line of code. I imagine this is either 2.0.3 or 2.0.4?

@ghost
Copy link
Author

ghost commented Mar 7, 2021

Do you happen to know what version this was tested on? I believe I made some optimizations in 2.1.0 beta, but this very well may still be an issue as I don't think I touched that exact line of code. I imagine this is either 2.0.3 or 2.0.4?

Specifically 2.0.3 as I just downloaded JasKnightWings' mod folder to test with a lot of other mods, but the code is still present in 2.0.4 which is the latest on the forums, so I based it off of that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: MED This issue is of medium priority. Status: Todo This issue has been approved and needs to be completed/implemented. Type: Bug This issue contains a bug.
Projects
None yet
Development

No branches or pull requests

1 participant