diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2021-03-12 08:55:20 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-12 08:55:20 +0900 |
| commit | 02326d552176438cd48d597972e37f849c3040ba (patch) | |
| tree | e31b23ef5aa94918048cfed69ce66e918b099341 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | 3e6e808aa69001eeb4b65cfeff165832616a7355 (diff) | |
| parent | 3934dd1b3e7514959202de6ca0d2636bcae21830 (diff) | |
| download | rust-02326d552176438cd48d597972e37f849c3040ba.tar.gz rust-02326d552176438cd48d597972e37f849c3040ba.zip | |
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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
