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

faster map usage in Systems & Modules #4209

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package meteordevelopment.meteorclient.systems;

import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.game.GameLeftEvent;
import meteordevelopment.meteorclient.systems.accounts.Accounts;
Expand All @@ -20,13 +21,12 @@

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Systems {
@SuppressWarnings("rawtypes")
private static final Map<Class<? extends System>, System<?>> systems = new HashMap<>();
private static final Map<Class<? extends System>, System<?>> systems = new Reference2ReferenceOpenHashMap<>();
private static final List<Runnable> preLoadTasks = new ArrayList<>(1);

public static void addPreLoadTask(Runnable task) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.google.common.collect.Ordering;
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.Lifecycle;
import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.game.GameJoinedEvent;
import meteordevelopment.meteorclient.events.game.GameLeftEvent;
Expand Down Expand Up @@ -68,8 +69,8 @@ public class Modules extends System<Modules> {
private static final List<Category> CATEGORIES = new ArrayList<>();

private final List<Module> modules = new ArrayList<>();
private final Map<Class<? extends Module>, Module> moduleInstances = new HashMap<>();
private final Map<Category, List<Module>> groups = new HashMap<>();
private final Map<Class<? extends Module>, Module> moduleInstances = new Reference2ReferenceOpenHashMap<>();
private final Map<Category, List<Module>> groups = new Reference2ReferenceOpenHashMap<>();

private final List<Module> active = new ArrayList<>();
private Module moduleToBind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package meteordevelopment.meteorclient.utils.misc;

import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.game.ResourcePacksReloadedEvent;
import meteordevelopment.meteorclient.utils.PreInit;
Expand All @@ -28,12 +29,12 @@
import static meteordevelopment.meteorclient.MeteorClient.mc;

public class Names {
private static final Map<StatusEffect, String> statusEffectNames = new HashMap<>(16);
private static final Map<Item, String> itemNames = new HashMap<>(128);
private static final Map<Block, String> blockNames = new HashMap<>(128);
private static final Map<Enchantment, String> enchantmentNames = new HashMap<>(16);
private static final Map<EntityType<?>, String> entityTypeNames = new HashMap<>(64);
private static final Map<ParticleType<?>, String> particleTypesNames = new HashMap<>(64);
private static final Map<StatusEffect, String> statusEffectNames = new Reference2ObjectOpenHashMap<>(16);
private static final Map<Item, String> itemNames = new Reference2ObjectOpenHashMap<>(128);
private static final Map<Block, String> blockNames = new Reference2ObjectOpenHashMap<>(128);
private static final Map<Enchantment, String> enchantmentNames = new Reference2ObjectOpenHashMap<>(16);
private static final Map<EntityType<?>, String> entityTypeNames = new Reference2ObjectOpenHashMap<>(64);
private static final Map<ParticleType<?>, String> particleTypesNames = new Reference2ObjectOpenHashMap<>(64);
private static final Map<Identifier, String> soundNames = new HashMap<>(64);

@PreInit
Expand Down