JDK-6298794 : Construction performance of user created AWT components has become very slow
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-07-19
  • Updated: 2006-04-06
  • Resolved: 2005-09-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b53Fixed
Related Reports
Relates :  
Description
Construction performance of user created AWT components has become very slow. 100 times slower than creating a bootstrap component. It appears as part of a fix for Bug #4952802 that for every user component constructed, java.awt.Component checks to see is coalesceEvents is overriden. That is for every instance, not class. This procedure is expensive, particularly as failure to find the method causes an event to be created.

In addition to performance, there are also inadequacies in the logic applied:

 o Superclasses are not checked if they override the method. By the looks of the use of equals, Class.getMethod was used instead of getDeclaredMethod in an earlier version, before realising getMethod does not catch protected methods. getDeclaredMethod does not catch methods in superclasses. I believe this change also contributes most of the performance hit.

 o Any class under com.sun., sun. or javax. is assumed not to override the method.
 
 o A finaliser is added to Component. Subclasses that also override finalize may not call their super (see Effective Java). Peculiarly the guard idiom is used for the key, which does prevent class loader leakage. Only causes two small objects leaked per affected component, plus finalisation overhead.

###@###.### 2005-07-19 17:26:31 GMT

Comments
EVALUATION The fix was integrated as-is after the necessary testing on all platforms.
26-08-2005

EVALUATION Our benchmarks didn't show any noticeable regression in Component construction relative to other operations. However, as there is already a proposed fix we may investigate it when we will do the next performance update in Mustang.
22-07-2005