Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-225425

"/data modify" inserts source elements into target collection one by one

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.16.5, 21w19a, 1.17 Pre-release 1, 1.17, 1.17.1, 21w37a, 1.18.1, 22w03a, 22w05a, 1.18.2 Pre-release 1, 1.18.2, 22w11a, 22w12a, 1.19 Release Candidate 2, 1.19, 1.19.1, 1.19.2, 1.19.3 Release Candidate 1, 1.19.3 Release Candidate 2, 1.19.3, 23w03a, 23w05a, 1.19.4, 23w12a, 23w18a, 1.20 Pre-release 7, 1.20.2, 23w42a
    • Confirmed
    • Commands

      The bug

      /data modify ... insert|prepend|append ... inserts the source elements into the target collection one by one, not in batches. Because the internal collection of list tags and array tags are java.util.ArrayList and primitive arrays respectively, this way of insertion slows down performance by repeated unnecessary resizing of the target collection.

      This will be resolved by usingĀ java.util.ArrayList#addAll and org.apache.commons.lang3.ArrayUtils#addAll instead of java.util.ArrayList#add and org.apache.commons.lang3.ArrayUtils#add, respectively.

      Partially related to MC-221421.

            Unassigned Unassigned
            intsuc intsuc
            Votes:
            11 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: