On Fri, 17 Apr 2020 10:46:51 GMT, dannygonzalez <github.com+6702882+dannygonza...@openjdk.org> wrote:
>> The problem is that there are usually many nodes, but only very few scenes >> and windows, so registering a listener for >> each node on a scene or window is pretty bad design (also consider the >> amount of notifications that a scene change >> would trigger in such scenarios). As far as I can see, this is the only >> such listener and only needed for two very >> limited cases, and its addition in the past may have slipped through the >> cracks. Adding a performance unit test that >> specifically checks add/remove performance of nodes may prevent such future >> regressions. > > @hjohn, agreed regards the issues of adding a listener to each node. > > Would it be worth doing the additional work of updating PopupWindow and > ProgressIndicatorSkin to add their own > listeners to make this a pull request that can be reviewed officially? > I await any further comments from @kevinrushforth et al. I have attached a code sample. If you use OpenJFX 16-ea+1 and run visual VM and look at the hotspots in the JavaFX thread, you can see that about 45% of the time in the JavaFX thread is spent in removeListener calls. Note: In CPU settings of VisualVM, I removed all packages from the "Do not profile packages section". [JavaFXSluggish.java.zip](https://github.com/openjdk/jfx/files/5130298/JavaFXSluggish.java.zip) ------------- PR: https://git.openjdk.java.net/jfx/pull/108