Repository navigation
Conversation
reduce early startup EDT usage by updating the splash only once every 50ms. - 15-40ms less EDT usage. - 70ms less main thread usage blocking on invokeLater()
| } catch (IllegalStateException splashAlreadyClosed) {} | ||
| next = System.currentTimeMillis() + 200; | ||
| } | ||
| paint(); |
There was a problem hiding this comment.
IIRC we don't reach this code in practice any more - comp is never null?
There was a problem hiding this comment.
the original logic (which was left in tact when splash was moved to the EDT in #9303) is still in place.
setRunning() checks if getSplashScreen() returns something, if it does it initializes a different painter while leaving comp null. So this branch is still theoretically reachable when the splash launcher flag is used. It still exists in the windows launcher AFAIR. I remember testing this with two splash pngs, one was green one was blue - probably a comment somewhere on the original PR.
Also: i think setRunning(false) should also set comp to null but I probably didn't do that since the getter is public - this could cause an NPE somewhere.
There was a problem hiding this comment.
Sure, if you manually create the splash file it might trigger, but the code to actually generate that file doesn't run since #1246 So, in practice this timing code using next is not used in the current release.
That wasn't an argument against your approach, or in favour of removing the comp == null code. Just a useful note to consider in reviewing what has actually changed here during startup.
neilcsmith-net
left a comment
There was a problem hiding this comment.
I think this looks good. I don't think we ever hit the timed code in repaint any more.
Could possibly just use a Swing Timer to drive repaints and not use invokeLater at all if it's a concern?
|
i considered a timer but this seemed easier since the code was already there, it was just moved outside of the EDT call |
|
Sure, that's fine, just the existing timing code is (should) never be hit anyway. |
reduce early startup EDT usage by updating the splash only once every 50ms.
repaint()works)invokeLater()(surprisingly expensive)(measured with all clusters active after a few warmup runs)
delayed followup to #9303