Open xuset opened 7 years ago
This will at least double the latency of the page load, since the network calls will have to be sequential.
I don't think we should make the optimization decision here unless it is transparent to the user
As of now, update() does not delay the page load time.
While update() will take longer with the optimization when an update is found because the requests are sequential, it will on average take less time due to the fact that updates to a website are likely to be more infrequent then the calls to update(). When no updates are found, the most frequent case, update() takes less time.
Not only that, browsers limit the number of concurrent http requests to about ~8 so initiating 4 http requests every time update() is called cuts in half the available pool of requests which can cause page loads to take even longer.
When update() is called, it makes 4 http requests which makes calling update() frequently infeasible. The files requested everytime update() is called:
planktos/root.torrent
planktos/manifest.json
planktos/install.js
planktos/planktos.min.js
It is better to only request
planktos/root.torrent
initially, and if the torrent is new then request the remaining files.