EVALUATION
Actually, the SplashScreen code set the _Xdebug variable to 1 at the SplashInitPlatform() function at the src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c file. This caused the Xlib to operate in debug mode, and the debug mode is a synchronous mode. Hence, Xlib invoked the XSync() function after almost every X method invokation. The XSync() function actually generates the GetInputFocus request (that was observed. see the previous evaluation message). Eliminating the _Xdebug setting should considerably improve the performance of applications using the splash screen.
|
|
|
SUGGESTED FIX
$ sccs diffs -C splashscreen_sys.c
------- splashscreen_sys.c -------
*** /tmp/sccs.KYnARO 2007-07-25 13:48:32.000000000 +0400
--- splashscreen_sys.c 2007-07-25 13:48:22.000000000 +0400
***************
*** 392,398 ****
SplashInitPlatform(Splash * splash) {
int shapeVersionMajor, shapeVersionMinor;
! _Xdebug = 1;
pthread_mutex_init(&splash->lock, NULL);
--- 392,400 ----
SplashInitPlatform(Splash * splash) {
int shapeVersionMajor, shapeVersionMinor;
! // This setting enables the synchronous Xlib mode!
! // Don't use it == 1 in production builds!
! //_Xdebug = 1;
pthread_mutex_init(&splash->lock, NULL);
|
|
|
EVALUATION
Using xmond I have noticed that when the application is ran with -splash:/dev/null option, lots of GetInputFocus X-server request are being generated. WHen there's no -splash option, there're much fewer such requests.
|
|
|
EVALUATION
When the application is ran with -splash option, the GetInputFocus request is being sent on every MouseMove. That seems to be the cause of the slowdown. However, putting a debug print into the XlibWrapper XGetInputFocus function does show nothing. It means that these requests are not generated via this method. Need to investigate a bit deeper the source of these requests.
|
|
|
EVALUATION
It's not easy to notice the performance drop, and ever more difficult to measure it. However, I was able to make both (approximately) by inserting some println statements. The new test file is attached.
I calculated the time between the start of main() method and the end of main() method and the first paint() method. Of course, this measurement doesn't reflect the time spent in splashscreen code before JVM started, however I can see some performance drop even after JVM is started.
Results on my desktop are the following:
----------------------------------------------------------------------------
| w/ -splash option | w/o -splash option |
----------------------------------------------------------------------------
start of main() -> end of main() | ~930 ms | ~880 ms |
start of main() -> first paint() | ~1750 ms | ~1450 ms |
----------------------------------------------------------------------------
|
|
|
|