Opened 5 years ago

Last modified 5 years ago

#20813 closed enhancement

Modernize org.openstreetmap.josm.gui.layer.geoimage.ImageDisplay — at Version 3

Reported by: simon04 Owned by: simon04
Priority: normal Milestone: 21.05
Component: Core image mapping Version:
Keywords: heap profiling intellij yourkit Cc: Don-vip, taylor.smock, Bjoeni, GerdP, StephaneP

Description (last modified by simon04)

  1. ImageDisplay is using java.awt.MediaTracker.

According to https://stackoverflow.com/a/7369580/205629 (written in 2010):

MediaTracker was useful in 1995. Back then the primary GUI use of java was Applets, and Applets would usually load images slowly over the network.
...
These days you can typically load images synchronously, and it is best to use ImageIO.

  1. ImageDisplay creates a new thread for each image to be loaded. We can use MainApplication.worker

attachment:20813-alpha.patch​ contains 1. + 2.

  1. Omit rescaling via ImageProvider.toBufferedImage and ImageProvider.createScaledImage? When zapping through images, approx. 50% of heap allocations are due to ImageIO.read() and approx. 50% are due to ImageProvider.toBufferedImage/ImageProvider.createScaledImage.

Change History (4)

by simon04, 5 years ago

Attachment: 20813-alpha.patch added

comment:1 by simon04, 5 years ago

Description: modified (diff)

comment:2 by simon04, 5 years ago

Cc: Don-vip taylor.smock Bjoeni added

comment:3 by simon04, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.