diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-02-19 17:22:30 -0800 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2021-03-02 13:55:25 -0800 |
| commit | 768d5e950953738a54480e530341964838d29da2 (patch) | |
| tree | 6b44fb67eddcd9206ca637124f1c14c38efd6aa4 /compiler/rustc_mir/src/transform/coverage/debug.rs | |
| parent | 94736c434ee154b30e2ec22ec112b79e3f6c5884 (diff) | |
| download | rust-768d5e950953738a54480e530341964838d29da2.tar.gz rust-768d5e950953738a54480e530341964838d29da2.zip | |
Load rustdoc's JS search index on-demand.
Instead of being loaded on every page, the JS search index is now loaded when either (a) there is a `?search=` param, or (b) the search input is focused. This saves both CPU and bandwidth. As of Feb 2021, https://doc.rust-lang.org/search-index1.50.0.js is 273,838 bytes gzipped or 2,544,939 bytes uncompressed. Evaluating it takes 445 ms of CPU time in Chrome 88 on a i7-10710U CPU (out of a total ~2,100 ms page reload). Generate separate JS file with crate names. This is much smaller than the full search index, and is used in the "hot path" to draw the page. In particular it's used to crate the dropdown for the search bar, and to append a list of crates to the sidebar (on some pages). Skip early search that can bypass 500ms timeout. This was occurring when someone had typed some text during the load of search-index.js. Their query was usually not ready to execute, and the search itself is fairly expensive, delaying the overall load, which delayed the input / keyup events, which delayed eventually executing the query.
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions
