Skip to content

Glyph Rendering Performance #139

@ghost

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: MEDThis issue is of medium priority.Status: TodoThis issue has been approved and needs to be completed/implemented.Type: BugThis issue contains a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions