<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>I think I've found the issue. Note that on my machine I can't
really reproduce the problem as clearly (Windows 10) as the
performance degradation is not quite as bad as mentioned in the
issue (maybe a factor of 2, and scrolling was unaffected), but
it's probably what you are seeing as little else changed in the PR
that seems to be the root cause. Still, VisualVM did hint at the
probable culprit (SimpleSelector#applies).</p>
<p>The problem is that BitSet (used for storing and comparing CSS
style classes) has special logic to do fast containsAll checks if
it detects it is compared against another BitSet. However, due to
a read only wrapper on one of the sets this detection fails, and
it will fall back to standard containsAll logic which is a bit
slower.</p>
<p>The fix should be relatively trivial, and I'll create a PR soon.<br>
</p>
<p>I did note a few other things in my investigation:</p>
<p>- JFXCentral has around 1000 style classes, which means a BitSet
as currently implemented, could use 125 bytes of memory for each
StyleClassSet if a high bit was set<br>
- Most selectors involve only 1 style class, sometimes 2 and
rarely 3 or more<br>
- Most nodes have 1 style class, sometimes 2 and rarely 3 or more<br>
<br>
Now, if I were to implement this kind of logic knowing that the
number of possible style classes can be quite high, and knowing
that most selectors and nodes will rarely have 3 or more style
classes assigned to them, I'd probably not use a non-sparse bit
set as it is currently implemented.</p>
<p>I've played around a bit with a sparse bitset, and although I did
not see amazing (overall) performance gains, the change (after
applying the regression fix) did shave off another 10-20 ms for
the "loadTimeFX" measurement in the JFXCentral application.</p>
<p>--John<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 31/12/2023 15:24, Christopher
Schnick wrote:<br>
</div>
<blockquote type="cite"
cite="mid:8cdf6073-0b62-4ffc-8da3-56750416fc91@xpipe.io">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>Hello, <br>
<br>
I just tested this with our JavaFX application and can confirm
that there are massive differences. It takes around 1-2 seconds
to completely apply all application stylesheets in JavaFX 20 but
takes around 6-7 seconds in JavaFX 21.<br>
</p>
<div class="moz-cite-prefix">On 12/31/2023 3:00 PM, Florian
Kirmaier wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CA+4mSqZjxaX586KJaQLnf44F_q-FEivjqgEFinv2mc8nidjo0Q@mail.gmail.com">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<div dir="ltr">Hi Everyone,<br>
<br>
Sorry for the delay - but I couldn’t find the time to extract
the TestApplication for this bug.<br>
Luckily, I found another application, which is also open
source, which is affected by the application.
<div><br>
I'm speaking about <a href="https://www.jfx-central.com/"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://www.jfx-central.com/</a> -
both the desktop and web versions are affected.<br>
I’ve seen a performance deterioration of 10x when switching
pages when using JavaFX21 compared to JavaFX20.<br>
<br>
I’ve created a ticket with further instructions on how to
test it:<br>
<a href="https://bugs.openjdk.org/browse/JDK-8322795"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8322795</a><br>
<br>
Greetings<font color="#888888"><br>
<br>
Florian Kirmaier</font></div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, 27 Oct 2023 at
21:31, Andy Goryachev <<a
href="mailto:andy.goryachev@oracle.com"
moz-do-not-send="true" class="moz-txt-link-freetext">andy.goryachev@oracle.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div class="msg9047044901516997342">
<div style="overflow-wrap: break-word;" lang="EN-US">
<div class="m_9047044901516997342WordSection1">
<p class="MsoNormal"><span
style="font-size:11pt;font-family:"Iosevka
Fixed SS16"">Please create a ticket,
Florian. Would it be possible to profile the
application when scrolling?</span></p>
<p class="MsoNormal"><span
style="font-size:11pt;font-family:"Iosevka
Fixed SS16""> </span></p>
<p class="MsoNormal"><span
style="font-size:11pt;font-family:"Iosevka
Fixed SS16"">Thank you</span></p>
<p class="MsoNormal"><span
style="font-size:11pt;font-family:"Iosevka
Fixed SS16"">-andy</span></p>
<p class="MsoNormal"><span
style="font-size:11pt;font-family:"Iosevka
Fixed SS16""> </span></p>
<p class="MsoNormal"><span
style="font-size:11pt;font-family:"Iosevka
Fixed SS16""> </span></p>
<p class="MsoNormal"><span
style="font-size:11pt;font-family:"Iosevka
Fixed SS16""> </span></p>
<div
id="m_9047044901516997342mail-editor-reference-message-container">
<div>
<div
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt
solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span
style="font-size:12pt;color:black">From: </span></b><span
style="font-size:12pt;color:black">openjfx-dev
<<a
href="mailto:openjfx-dev-retn@openjdk.org"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev-retn@openjdk.org</a>>
on behalf of Florian Kirmaier <<a
href="mailto:florian.kirmaier@gmail.com"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">florian.kirmaier@gmail.com</a>><br>
<b>Date: </b>Friday, October 27, 2023 at
04:20<br>
<b>To: </b><a
href="mailto:openjfx-dev@openjdk.java.net"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev@openjdk.java.net</a>
<<a
href="mailto:openjfx-dev@openjdk.java.net"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev@openjdk.java.net</a>><br>
<b>Subject: </b>Performance Regression in
21 - CSS</span></p>
</div>
<div>
<p class="MsoNormal"><span
style="font-size:11pt">Hi everyone,<br>
<br>
I've noticed that some parts of one of my
applications is significantly slower with
21. It's fast with 20.<br>
The application heavily uses (and reuses)
TextFlow with a Cell pattern.<br>
When I scroll, it is smooth with 20, but has
big freezes with 21.<br>
<br>
I've tried all the commits that happened in
between, and pin-pointed it down to the
following:<br>
ticket: <a
href="https://bugs.openjdk.org/browse/JDK-8304959"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8304959</a><br>
PR: <a
href="https://github.com/openjdk/jfx/pull/1070"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://github.com/openjdk/jfx/pull/1070</a><br>
commit: <a
href="https://github.com/openjdk/jfx21u/commit/3fa02ee96a6dadbc20cacbf399a2d65df708eee1"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://github.com/openjdk/jfx21u/commit/3fa02ee96a6dadbc20cacbf399a2d65df708eee1</a><br>
<br>
<br>
According to the description and the
discussion in the PR - this wasn't supposed
to change any performance.<br>
Is this regression known?<br>
Otherwise, I should create a ticket for it.<br>
<br>
Greetings Florian</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</blockquote>
</body>
</html>