Skip to content

Commit

Permalink
avoid enummap iterator on very hot path
Browse files Browse the repository at this point in the history
  • Loading branch information
thiakil committed Aug 30, 2024
1 parent bfe0f48 commit 3c3774a
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,12 @@ public boolean isEjecting(ConfigInfo info, TransmissionType type) {
}

public void tickServer() {
for (Map.Entry<TransmissionType, ConfigInfo> entry : configInfo.entrySet()) {
TransmissionType type = entry.getKey();
ConfigInfo info = entry.getValue();
//loop on array to avoid iterator usage and high memory consumption
for (TransmissionType type : EnumUtils.TRANSMISSION_TYPES) {
ConfigInfo info = configInfo.get(type);
if (info == null) {
continue;
}
if (isEjecting(info, type)) {
if (type == TransmissionType.ITEM) {
if (tickDelay == 0) {
Expand Down

0 comments on commit 3c3774a

Please sign in to comment.