Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3878

Make ArrayList creation with initial capacity when size is fixed

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.22.0
    • Fix Version/s: 1.23.0
    • Component/s: core

      Description

      I find many places in Calcite where new ArrayList<>() is used, if the list is expected to be immutable or not resizing, it is always a good manner to create with initial capacity, better for memory usage and performance.

      I search all occurrences, focus on the core module, to make it safe, I only update local variables with fixed size and not working in recursive method. If the local variable reference goes out of scope, if resizing is needed, things will work normally as well, so no side effect, but for the "escaping" case, I am very conservative and do not change them.

       

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                neoremind neoremind
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 40m
                  1h 40m