java.awt.dnd.DropTarget.<init> takes about 5.5% of Notepad startup time according to Netbeans profiler. Most of the time is spent inside SystemFlavorMap.getDefaultFlavorMap(). However, it seems that initializing default flavor map is not really necessary on startup and could be postponed. It is only used to initialize private transient variable and this initialization can be delayed until after startup (e.g. to the time of first use). See suggested fix. Preliminary test shows noticeable performance inprovement for startup3 benchmark. Especially on tiny swing applications: ============================================================================ logs/mybuild Benchmark Samples Mean Stdev Geomean Weight startup3 25 3.94 0.03 Framer 25 0.66 0.04 JEdit 25 3.13 0.09 LimeWire 25 3.99 0.02 NetBeans 25 10.03 0.07 Noop 25 0.16 0.00 XFramer 25 0.80 0.05 ============================================================================ logs/mybuild.dd Benchmark Samples Mean Stdev %Diff P Significant startup3 25 3.75 0.05 4.85 0.000 Yes Framer 25 0.58 0.00 11.84 0.000 Yes JEdit 25 2.97 0.08 5.07 0.000 Yes LimeWire 25 3.85 0.04 3.41 0.000 Yes NetBeans 25 9.68 0.29 3.47 0.000 Yes Noop 25 0.16 0.00 1.49 0.034 * XFramer 25 0.64 0.00 20.04 0.000 Yes ============================================================================
|