Based on the information provided, we can only offer generic advice.
Rather than loading the data as part of the page, try to return the page without any data, and then use an AJAX /
fetch[
^] request to load the data from script.
Use your browser's developer tools to measure the performance of your page load to determine where the bottleneck is. It could simply be that a large amount of data included directly in the page takes a long time to download or parse.
Consider referencing common scripts and CSS from a content delivery network (CDN), particularly if your own site's bandwidth is limited. But make sure you use
Subresource Integrity attributes[
^] to protect your users against malicious modifications to the resources you're loading from the CDN.