Details
-
Bug
-
Resolution: Fixed
-
P4
-
6, 7, 8
-
b94
-
generic
-
generic
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8018837 | 7u45 | Vladislav Karnaukhov | P4 | Closed | Fixed | b01 |
JDK-8015793 | 7u40 | Vladislav Karnaukhov | P4 | Closed | Fixed | b30 |
JDK-8015794 | 6-pool | Vladislav Karnaukhov | P4 | Closed | Won't Fix |
Description
src/share/classes/javax/swing/DefaultComboBoxModel.java:51: public DefaultComboBoxModel(final Object items[]) {
src/share/classes/javax/swing/DefaultComboBoxModel.java:52: objects = new Vector();
src/share/classes/javax/swing/DefaultComboBoxModel.java:53: objects.ensureCapacity( items.length );
creates a default-sized Vector and then resizes it. That probably drops the default-sized backing array on the floor and allocates a new one. It would be more efficient to create the Vector with the appropriate size. I don't know what the average size of the items array is to the DefaultComboBoxModel constructor. If that array is typically small, then maybe this isn't a problem.
src/share/classes/javax/swing/DefaultComboBoxModel.java:52: objects = new Vector();
src/share/classes/javax/swing/DefaultComboBoxModel.java:53: objects.ensureCapacity( items.length );
creates a default-sized Vector and then resizes it. That probably drops the default-sized backing array on the floor and allocates a new one. It would be more efficient to create the Vector with the appropriate size. I don't know what the average size of the items array is to the DefaultComboBoxModel constructor. If that array is typically small, then maybe this isn't a problem.
Attachments
Issue Links
- backported by
-
JDK-8015793 Vector could be created with appropriate size in DefaultComboBoxModel
- Closed
-
JDK-8015794 Vector could be created with appropriate size in DefaultComboBoxModel
- Closed
-
JDK-8018837 Vector could be created with appropriate size in DefaultComboBoxModel
- Closed