loads a file called main.js which makes a request for two WASM files. Instead of having to wait to download and parse the JS and then downloading the WASM, I added this line to my HTML’s <head> so that the three files would be downloaded at the same time:
This works on my local machine the way you’d expect which you can try like this
git clone https://github.com/curlconverter/curlconverter.github.io.git
and it worked while the site was hosted on GitHub Pages (i.e. Fastly CDN). As you can see in the waterfall, the two wasm files are downloaded at the same time as the JS and when the JS asks for them they aren’t re-downloaded
However, on my live Cloudflare Pages website, this is not the case, the two wasm files are downloaded once at the same time as the JS file, but then downloaded a second time after they are requested by the JS code:
I came across this thread which seems to say that prefetching is an enterprise feature, though I have no idea if this is the same thing I’m doing? This is a free open source project, so I’m obviously not going to pay for this.
@M4rt1n I moved the site back to GitHub Pages so feel free to check it out.
I moved back because of this issue and because GitHub Actions lets us deploy the latest commit in our main repo on GitHub to the website instead of just the latest release on npm, because it can compile WASM in Docker. I got a 3x or 2x speed up in load time:
I understand that in your particular case, it makes more sense to use GH Pages.
But about the speed:
These two images are bad to compare, because the one for Cloudflare, was a cold load (DNS, SSL etc was all not done) and on GH Pages, it was a warm connection.
But on the other hand, some connections have been faster on GH Pages, some on Cloudflare.
And the one on Cloudflare loads more resources than the one on GH Pages, but due to Cloudflare’s compression etc it even with more ressources is smaller (in download sice).
If you figure out what with your .wasm file is weird, I would recommend you switching back to Cloudflare, but if you don’t have the time I understand not doing so.
Soon Pages Build v2 will be released, I would recommend you checking back then, things improve quickly here.