Is there a benefit to importing all your libraries from the same CDN? For example, would using an import list that sources all libraries from cdnjs.cloudflare.com like so:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js" integrity="sha512-IsNh5E3eYy3tr/JiX2Yx4vsCujtkhwl7SLqgnwLNgf04Hrt9BT9SXlLlZlWx+OK4ndzAoALhsMNcCmkggjZB1w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/aos/2.3.4/aos.js" integrity="sha512-A7AYk1fGKX6S2SsHywmPkrnzTZHrgiVT7GcQkLGDe2ev0aWb8zejytzS8wjo7PGEXKqJOrjQ4oORtnimIRZBtw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
be faster than importing them from various CDNs like this:
<script src="https://code.jquery.com/jquery-3.6.3.min.js"integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU="crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js" integrity="sha512-IsNh5E3eYy3tr/JiX2Yx4vsCujtkhwl7SLqgnwLNgf04Hrt9BT9SXlLlZlWx+OK4ndzAoALhsMNcCmkggjZB1w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
Since I don't have a particularly large import list for this project, my tests haven't shown any marked difference. I think the answer differs according to how you host the app as well, but I'm not sure how to test this.
I wasn't exactly certain of a way to test the performance exactly. If anyone has any thoughts on ways to test and compare accurately I'd be very interested in that as well!
Thanks in advance for any input!
Short answer: Yes, there is a benefit but often not a huge one.
Longer answer: Each CDN you use is another connection that needs to be established and in most cases a new TLS connection that need to be negotiated. For a high speed internet connection on a moderately modern device that will be mostly unnoticeable but on spotty connections (using the mobile while riding the subway for example) or on an older low end device it might be noticeable.
It is also a security aspect to it. If you have a multiple CDNs and one of them is breached to deliver malicious code then you are at a greater risk then if you only load from a single one (though if that is the one that is breached then you are of course out of luck anyway).
So while it isn't a huge problem using several CDNs, if you can avoid it then avoid it.