When I reload the editor page it often takes 20 seconds or so, which is painful as I am debugging and have to keep restarting. This is running node red on an i5 Ubuntu machine with the browser on the same machine.
When I look at the network tab most things are milliseconds, but I see
Interesting. On my dev PC (W11, i9, 32GB RAM), it is still taking 4 seconds. But the most telling thing is that it is not being cached and that is surely wrong.
The mermaid library is dynamically loaded the first time it's needed - or something like that. Unlike the other libaries that are all loaded as part of loading the editor.
It real seems that the mermaid library takes a very long time downloading, but the strange part is that there are others "pieces" that are larger and takes lower time.
In the case of the download of the mermaid, wireshark indeed has some big gaps, and complains about some things...
<!-- #region Supporting Scripts. These MUST be in the right order. Note no leading / -->
<script defer src="https://cdn.jsdelivr.net/npm/mermaid@10.9.1/dist/mermaid.min.js"></script>
<script defer src="../uibuilder/uibuilder.iife.min.js"></script>
<script defer src="./index.js">/* OPTIONAL: Put your custom code in that */</script>
<!-- #endregion -->
Not only is it MUCH smaller, it loads in a reasonable time. Weirdly small.
Installing the mermaid npm package in uibuilder and calling the local version gives this:
Having upgraded to 4.0.2 I am still not seeing mermaid being cached. It appears to have a cache-control max-age of 0, which I think says not to cache it.
I don't think so actually since I tested it on a separate page and whilst it is pretty big, it only took 141ms from CDN! Not the 3.6s it is taking on my beefy dev PC.
And, I'm afraid it isn't caching. While the cache-buster now remains static, it is still showing a response code of 200 meaning that the browser can't cache it locally. I should be seeing a 304 on a reload.
Oops, my bad, I forgot to turn off disabled cache in dev tools!
So it is caching - but it is still taking 3 1/2 seconds to load for some reason. It doesn't do that on simpler web pages.
Content Download. The browser is receiving the response, either directly from the network or from a service worker. This value is the total amount of time spent reading the response body. Larger than expected values could indicate a slow network, or that the browser is busy performing other work which delays the response from being read.
Content download for the mermaid library is showing as 4s on my device. To me, the most likely issue is that the page load is processing a bunch of other stuff at the same time. I can't think of another reason this would take so long for Node-RED but not for another page.