<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    I tried it, 99% of the heavy lift comes from FXML load.<br>
    I have 80Kb of FXML files, nothing particularly big,<br>
    I measured the laoding time on a 13900K CPU and it requires 1.8s.<br>
    <br>
    Once loaded, I don't know how this is possible, my apps sucks 100MB
    more RAM but after the first load,<br>
    opening/closing the tab pane is much faster.<br>
    <br>
    I sincerely can't understand how a tabpane can suck 100MB od RAM and
    how 80Kb of FXML can require almoast 2 seconds to load<br>
    on the world fastest consumer CPU (single thread).<br>
    <br>
    I see that there are dozens of similar threads on the internet so
    this should be a known problem<br>
    and at this point, I think that I'm out of luck.<br>
    <br>
    Thank you anyway,<br>
    Davide<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Il 25/08/2023 23:55, Andy Goryachev ha
      scritto:<br>
    </div>
    <blockquote type="cite"
cite="mid:DM5PR1001MB21727525B1F832B357649B9FE5E3A@DM5PR1001MB2172.namprd10.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:"Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
        {font-family:"Iosevka Fixed SS16";
        panose-1:2 0 5 9 3 0 0 0 0 4;}@font-face
        {font-family:"Times New Roman \(Body CS\)";
        panose-1:2 11 6 4 2 2 2 2 2 4;}@font-face
        {font-family:"Iosevka Fixed SS16 ";
        panose-1:2 0 5 9 3 0 0 0 0 4;}@font-face
        {font-family:"\@Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Iosevka Fixed SS16";
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">Another suggestion might be to load tabs
            lazily.  I don't think FXML "pre-loading" is possible.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">-andy<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <div style="border:none;border-top:solid #B5C4DF
          1.0pt;padding:3.0pt 0in 0in 0in">
          <p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
                style="font-size:12.0pt;color:black">From:
              </span></b><span style="font-size:12.0pt;color:black">Davide
              Perini <a class="moz-txt-link-rfc2396E" href="mailto:perini.davide@dpsoftware.org"><perini.davide@dpsoftware.org></a><br>
              <b>Date: </b>Friday, August 25, 2023 at 14:31<br>
              <b>To: </b>Andy Goryachev
              <a class="moz-txt-link-rfc2396E" href="mailto:andy.goryachev@oracle.com"><andy.goryachev@oracle.com></a>, <a class="moz-txt-link-abbreviated" href="mailto:openjfx-dev@openjdk.org">openjfx-dev@openjdk.org</a>
              <a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev@openjdk.org"><openjfx-dev@openjdk.org></a><br>
              <b>Subject: </b>[External] : Re: Preload fxml to avoid
              slow show()<o:p></o:p></span></p>
        </div>
        <p class="MsoNormal" style="margin-bottom:12.0pt"><span
            style="font-size:11.0pt">My tab pane is very complex with a
            lot of tabs,
            <br>
            having an FXML is very welcomed.<br>
            <br>
            Thanks<br>
            Davide<o:p></o:p></span></p>
        <div>
          <p class="MsoNormal"><span style="font-size:11.0pt">Il
              25/08/2023 16:45, Andy Goryachev ha scritto:<o:p></o:p></span></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Iosevka Fixed
              SS16 "">You can try creating the scene graph
              programmatically, thus avoiding FXML entirely.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Iosevka Fixed
              SS16 ""> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Iosevka Fixed
              SS16 "">-andy</span><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Iosevka Fixed
              SS16 ""> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:11.0pt;font-family:"Iosevka Fixed
              SS16 ""> </span><o:p></o:p></p>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0in 0in 0in">
            <p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
                  style="font-size:12.0pt;color:black">From:
                </span></b><span style="font-size:12.0pt;color:black">openjfx-dev
                <a href="mailto:openjfx-dev-retn@openjdk.org"
                  moz-do-not-send="true">
                  <openjfx-dev-retn@openjdk.org></a> on behalf of
                Davide Perini <a
                  href="mailto:perini.davide@dpsoftware.org"
                  moz-do-not-send="true">
                  <perini.davide@dpsoftware.org></a><br>
                <b>Date: </b>Friday, August 25, 2023 at 00:45<br>
                <b>To: </b><a href="mailto:openjfx-dev@openjdk.org"
                  moz-do-not-send="true" class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a>
                <a href="mailto:openjfx-dev@openjdk.org"
                  moz-do-not-send="true">
                  <openjfx-dev@openjdk.org></a><br>
                <b>Subject: </b>Preload fxml to avoid slow show()</span><o:p></o:p></p>
          </div>
          <div>
            <p class="MsoNormal"><span style="font-size:11.0pt">Hi,<br>
                I have a tabpane with 15 tabs, every tab has his own
                controller and it's <br>
                pretty crowded.<br>
                <br>
                On a 13900K CPU, show() method requires more than 750ms,<br>
                this feels laggy...<br>
                <br>
                After the first show() call, loading the tab pane is
                much faster...<br>
                <br>
                Is there a way to "preload" an fxml?<br>
                <br>
                I tried to show() and hide() it immediately and it seems
                to help,<br>
                but what is the best way to do it?<br>
                <br>
                Thanks<br>
                Davide</span><o:p></o:p></p>
          </div>
        </blockquote>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>