In a recent startup performance analysis, the initialization of the
UI defaults for Swing took up a large percentage (about 10%) of the overall
time to start a simple Swing app. Much of the work boiled down to simple
(but very plentiful) method calls such as:
- StringBuffer.append (which can end up calling StringBuffer.expandCapacity, which can be quite expensive; there was one call in the test app that took
nearly 25 ms)
- Hashtable.put: there are a LOT of these calls made during initComponentDefaults
- ResourceBundle.findBundle: there are a lot of these relatively expensive calls in UIDefaults.getResourceCache
- Hash.[put|get]: LOTS of calls to these methods are made in some of the methods called from UIDefaults.getResourceCache