Avoid iterators for hot paths.

This commit is contained in:
NathanSweet 2019-12-05 13:27:41 +01:00
parent 65752c6d39
commit 068a554cc9
2 changed files with 7 additions and 4 deletions

View File

@ -65,8 +65,8 @@ public class Animation {
this.timelines = timelines;
timelineIds.clear();
for (Timeline timeline : timelines)
timelineIds.addAll(timeline.getPropertyIds());
for (int i = 0, n = timelines.size; i < n; i++)
timelineIds.addAll(timelines.get(i).getPropertyIds());
}
/** Returns true if this animation contains a timeline with any of the specified property IDs. **/

View File

@ -294,8 +294,11 @@ public class Skeleton {
}
private void sortPathConstraintAttachment (Skin skin, int slotIndex, Bone slotBone) {
for (SkinEntry entry : skin.attachments.orderedItems())
if (entry.getSlotIndex() == slotIndex) sortPathConstraintAttachment(entry.getAttachment(), slotBone);
Object[] entries = skin.attachments.orderedItems().items;
for (int i = 0, n = skin.attachments.size; i < n; i++) {
SkinEntry entry = (SkinEntry)entries[i];
if (entry.slotIndex == slotIndex) sortPathConstraintAttachment(entry.attachment, slotBone);
}
}
private void sortPathConstraintAttachment (Attachment attachment, Bone slotBone) {