Changeset 18836 in josm


Ignore:
Timestamp:
2023-09-20T20:08:14+02:00 (9 months ago)
Author:
taylor.smock
Message:

Reduce memory allocations from SplashScreenProgressRenderer#setTasks

This reduces startup memory allocations from that method to effectively zero from
475 MB. There is a total reduction of ~580 MB (or ~1/3 of startup memory
allocations). This reduces the GC pressure significantly, and reduces startup
time by 2.5-3.8 seconds.

Most of the additional memory allocation reductions come from not needing to
repaint the text caret after the setTasks call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/SplashScreen.java

    r18215 r18836  
    391391                + "<style>ul {margin-top: 0; margin-bottom: 0; padding: 0;} li {margin: 0; padding: 0;}</style>";
    392392
     393        private String lastTasks;
     394
    393395        protected void build() {
    394396            setLayout(new GridBagLayout());
     
    416418         */
    417419        public void setTasks(String tasks) {
    418             lblTaskTitle.setText(LABEL_HTML + tasks);
    419             lblTaskTitle.setCaretPosition(lblTaskTitle.getDocument().getLength());
    420             scrollPane.getHorizontalScrollBar().setValue(0);
     420            // Only update the display when the tasks change
     421            if (!Objects.equals(lastTasks, tasks)) {
     422                lastTasks = tasks;
     423                lblTaskTitle.setText(LABEL_HTML + tasks);
     424                lblTaskTitle.setCaretPosition(lblTaskTitle.getDocument().getLength());
     425                scrollPane.getHorizontalScrollBar().setValue(0);
     426            }
    421427        }
    422428    }
Note: See TracChangeset for help on using the changeset viewer.