EVALUATION
I have profiled the test a bit and found two bottlenecks: the places that reduce the speed of showing of the dialog most of all. First, the calls to XSetTransientFor in XWindowPeer.setToplevelTransientFor. Second, the calls to XQueryTree in XWindowPeer.collectJavaToplevels.
The first problem is relatively easy to fix. Most of the calls are redundant, I mean lead to setting the hint to the same value as it was already set to earlier. For example, if I have 3 windows blocked, the first's hint is set to null, the second's - to first, the third - to second's and then the second's - to first again. This can be solved by caching the current value of the hint.
The second problem is more difficult to resolve. The only way I found is to call for collectJavaToplevels only once for each modal dialog shown, and then using this set of top-levels to block all the windows blocked by this dialog, instead of calling this method for each window.
After these two improvements I see the great performance, however the dialogs are shown slower than with MToolkit. I suspect the further optimization is much more difficult, however if anyone requires it, I will have to do this.
|
EVALUATION
When a modal dialog is shown, it blocks some or all the Java windows. This blocking is a costly operation and we need to optimize it somehow. To better notice a delay when a dialog is shown, the test provided in the description should be modified to show >10 windows instead of 3.
|