rust/src/librustdoc/html
Yuki Okushi 02326d5521
Rollup merge of #83003 - notriddle:rustdoc-index-v3, r=GuillaumeGomez
rustdoc: tweak the search index format

This essentially switches search-index.js from a "array of struct" to a "struct of array" format, like this:

    {
    "doc": "Crate documentation",
    "t": [ 1, 1, 2, 3, ... ],
    "n": [ "Something", "SomethingElse", "whatever", "do_stuff", ... ],
    "q": [ "a::b", "", "", "", ... ],
    "d": [ "A Struct That Does Something", "Another Struct", "a function", "another function", ... ],
    "i": [ 0, 0, 1, 1, ... ],
    "f": [ null, null, [], [], ... ],
    "p": ...,
    "a": ...
    }

So `{ty: 1, name: "Something", path: "a::b", desc: "A Struct That Does Something", parent_idx: 0, search_type: null}` is the first item.

This makes the uncompressed version smaller, but it really shows on the compressed version:

    notriddle:rust$ wc -c new-search-index1.52.0.js
    2622427 new-search-index1.52.0.js
    notriddle:rust$ wc -c old-search-index1.52.0.js
    2725046 old-search-index1.52.0.js
    notriddle:rust$ gzip new-search-index1.52.0.js
    notriddle:rust$ gzip old-search-index1.52.0.js
    notriddle:rust$ wc -c new-search-index1.52.0.js.gz
    239385 new-search-index1.52.0.js.gz
    notriddle:rust$ wc -c old-search-index1.52.0.js.gz
    296328 old-search-index1.52.0.js.gz

That's a 4% improvement on the uncompressed version (fewer `[]`, and also changing `null` to `0` in the parent_idx list), and 20% improvement after gzipping it, thanks to putting like-typed data next to each other. Any compression algorithm based on a sliding window will probably show this kind of improvement.
2021-03-12 08:55:20 +09:00
..
highlight rustdoc tweaking 2021-01-30 01:02:18 +00:00
markdown Treat header as first paragraph for shortened markdown descriptions 2021-03-09 17:48:14 -07:00
render rustdoc: tweak the search index format 2021-03-10 20:20:42 -07:00
static Rollup merge of #83003 - notriddle:rustdoc-index-v3, r=GuillaumeGomez 2021-03-12 08:55:20 +09:00
toc Format the world 2019-12-22 17:42:47 -05:00
escape.rs rustdoc tweaking 2021-01-30 01:02:18 +00:00
format.rs Restore linking to itself in implementors section of trait page 2021-02-06 21:05:41 +01:00
highlight.rs rustdoc tweaking 2021-01-30 01:02:18 +00:00
layout.rs Rollup merge of #82315 - jsha:font-display-swap, r=GuillaumeGomez 2021-03-04 20:01:04 +09:00
markdown.rs Treat header as first paragraph for shortened markdown descriptions 2021-03-09 17:48:14 -07:00
mod.rs rustdoc: Note why rustdoc::html::markdown is public 2021-01-31 19:22:37 -08:00
sources.rs Make Clean take &mut DocContext 2021-02-16 21:25:14 -05:00
static_files.rs Embed woff2 files in rustdoc binary. 2021-02-26 00:38:05 -08:00
toc.rs clippy fixes for librustdoc 2021-01-01 21:19:10 +01:00