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

Performance issue with text parsing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 23w41a
    • 1.17.1, 21w37a, 21w38a, 21w39a, 21w40a, 21w41a, 21w42a, 21w43a, 21w44a, 1.18 Pre-release 1, 1.18 Pre-release 2, 1.18 Pre-release 3, 1.18 Pre-release 4, 1.18 Pre-release 6, 1.18 Pre-release 7, 1.18 Pre-release 8, 1.18 Release Candidate 2, 1.18 Release Candidate 3, 1.18 Release Candidate 4, 1.18, 1.18.1 Pre-release 1, 1.18.1 Release Candidate 1, 1.18.1 Release Candidate 2, 1.18.1, 22w03a, 22w06a, 1.18.2 Pre-release 1, 1.18.2 Pre-release 2, 1.18.2, 22w11a, 22w12a, 22w13a, 22w14a, 22w15a, 22w17a, 22w18a, 22w19a, 1.19 Pre-release 3, 1.19 Pre-release 4, 1.19 Pre-release 5, 1.19 Release Candidate 1, 1.19 Release Candidate 2, 1.19, 1.19.1 Pre-release 1, 1.19.1 Pre-release 2, 1.19.1 Pre-release 4, 1.19.1 Pre-release 5, 1.19.1, 1.19.2, 22w45a, 22w46a, 1.19.3 Pre-release 2, 1.19.3 Release Candidate 2, 1.19.3 Release Candidate 3, 1.19.3, 23w05a, 23w06a, 23w07a, 1.19.4 Pre-release 1, 1.19.4 Pre-release 2, 1.19.4 Pre-release 3, 1.19.4 Release Candidate 1, 1.19.4 Release Candidate 2, 1.19.4 Release Candidate 3, 1.19.4, 23w13a, 23w14a, 23w16a, 23w17a, 23w18a, 1.20 Pre-release 1, 1.20 Pre-release 2, 1.20 Release Candidate 1, 1.20, 1.20.1 Release Candidate 1, 1.20.1, 1.20.2
    • Plausible
    • Performance
    • Low
    • Platform

      The bug

      Since Minecraft 1.12 (or a bit before), some of the font rendering was remade, and a minor performance issue was introduced.

      In the ChatFormatting class:

      public static ChatFormatting getByCode(char c) {
          char lower = Character.toString(c).toLowerCase(Locale.ROOT).charAt(0);
      

      Here, there is a useless conversion from a character to a string, a lowercase string, then a character again. A simple Character.toLowerCase(c) would have been enough.

      This issue was even worse before 1.12, where the whole rendered text was being changed to lowercase on each color character, and was causing a ~1% performance drop when rendering a lot of text. Here the impact is minor, but would still be a good improvement to clean it up.

            Dat12 [Mojang] etanaratsastaja
            Rigner Rigner
            Votes:
            8 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: