|
|
|
|
|
by londons_explore
720 days ago
|
|
The goal was to have a web browser (chromium) able to 'guess' stuff about what response it will get from the network (ie. Will the server return the same JavaScript blob as last time). We start executing the JavaScript as-if the guess is correct. If the guess is wrong, we revert to a snapshot. It lets you make good use of CPU time whilst waiting for the network. It turns out simple heuristics can get 99% accuracy on the question of 'will the server return the same result as last time for this non-cachable response'. However, since my machine has many CPU cores it made sense to have many 'speculative' copies of the browser going at once. A regular fork() call would have worked, if not for the fact chromium is multi thread and multi process, and it's next to impossible to fork multiple processes as a group. |
|
It'd be cool to predict which resources are speculation safe (ie the cache headers don't permit it, but the content in practice doesn't change) and speculate those resources but not ones which you have repeatedly had a speculation abort (ie actual dynamic resources). If your predictor gets a high enough hit rate, you could probably do okay with just a single instance/no snapshot and use an expensive rollback mechanism (reload the whole page non-speculatively?).