Basically, you are right and a CDN is not generally an advantage. This is especially true if the visitors to a site come predominantly from your own country, because then direct access to the origin host is faster. However, if you have a lot of international access, you benefit significantly from a CDN, because resolving the IP address takes the most time on the first access. In such a case, whether your site is well or poorly optimized does not matter, because as long as the main document is not loaded, no static sources are loaded. This also applies if Early Hints headers are used. You can optimize your site as much as you like, but if the connectivity of your site is poor or inadequate, then the effort spent on optimization is worthless.
If it seems like I am promoting CDN, then only in the specific case of Early Hints. Unfortunately, LiteSpeed does not yet support these headers, but CloudFlare supports these headers in combination with the <link rel="preload"> tag.
When it comes to optimizing a page, regardless of a CDN, you should find out more about PageSpeed or any other web page test site. Loading any kind of source is irrelevant for PageSpeed and scoring. PageSpeed is about speed, but the measurement of speed refers to the display time and this begins from the moment AFTER sources have been loaded. The actual loading and the time required for this is irrelevant for PageSpeed. If PageSpeed took the time required for loading into account, the PageSpeed test would be falsified. The distance between server and client has a significant influence on the loading time, especially if the client (browser) has not yet resolved the IP address. This would mean that the PageSpeed test would be to the disadvantage of the hosts whose distance to the PageSpeed server is the greatest. Or to put it another way, a poorly optimized page but with a short distance to PageSpeed would be rated better than a host far away with the best possible optimization.
It should be obvious that loading sources does not play a role for PageSpeed and should not play a role. Otherwise it would not be an accurate measurement. PageSpeed therefore only measures the display time from the moment when all the sources required for display have been loaded.
If you want to find out more about this, then invest a few minutes of time and study these two posts:
https://www.cachecrawler.com/Knowledgebase/PageSpeed/PageSpeed-Loading-Time::6568.html
https://www.cachecrawler.com/Knowledgebase/PageSpeed/Loading-Time-versus-Display-Time::6569.html
If it seems like I am promoting CDN, then only in the specific case of Early Hints. Unfortunately, LiteSpeed does not yet support these headers, but CloudFlare supports these headers in combination with the <link rel="preload"> tag.
When it comes to optimizing a page, regardless of a CDN, you should find out more about PageSpeed or any other web page test site. Loading any kind of source is irrelevant for PageSpeed and scoring. PageSpeed is about speed, but the measurement of speed refers to the display time and this begins from the moment AFTER sources have been loaded. The actual loading and the time required for this is irrelevant for PageSpeed. If PageSpeed took the time required for loading into account, the PageSpeed test would be falsified. The distance between server and client has a significant influence on the loading time, especially if the client (browser) has not yet resolved the IP address. This would mean that the PageSpeed test would be to the disadvantage of the hosts whose distance to the PageSpeed server is the greatest. Or to put it another way, a poorly optimized page but with a short distance to PageSpeed would be rated better than a host far away with the best possible optimization.
It should be obvious that loading sources does not play a role for PageSpeed and should not play a role. Otherwise it would not be an accurate measurement. PageSpeed therefore only measures the display time from the moment when all the sources required for display have been loaded.
If you want to find out more about this, then invest a few minutes of time and study these two posts:
https://www.cachecrawler.com/Knowledgebase/PageSpeed/PageSpeed-Loading-Time::6568.html
https://www.cachecrawler.com/Knowledgebase/PageSpeed/Loading-Time-versus-Display-Time::6569.html