about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-12-30 20:56:59 -0700
committerMichael Howell <michael@notriddle.com>2023-12-31 01:03:35 -0700
commit86b9550811b359a0af7a93523fbd14c5cdcc635f (patch)
tree75686b0d1bb31962acb6b5f381478b903b7eb523 /compiler/rustc_pattern_analysis/src
parent1ab60f2a646e119db42a192771a4cdbc294fd5ff (diff)
downloadrust-86b9550811b359a0af7a93523fbd14c5cdcc635f.tar.gz
rust-86b9550811b359a0af7a93523fbd14c5cdcc635f.zip
rustdoc-search: tighter encoding for `f` index
Two optimizations for the function signature search:

* Instead of using JSON arrays, like `[1,20]`, it uses VLQ
  hex with no commas, like `[aAd]`.
* This also adds backrefs: if you have more than one function
  with exactly the same signature, it'll not only store it once,
  it'll *decode* it once, and store in the typeIdMap only once.

Size change
-----------

standard library

```console
$ du -bs search-index-old.js search-index-new.js
4976370 search-index-old.js
4404391 search-index-new.js
```

((4976370-4404391)/4404391)*100% = 12.9%

Benchmarks are similarly shrunk:

```console
$ du -hs tmp/{arti,cortex-m,sqlx,stm32f4,ripgrep}/toolchain_{old,new}/doc/search-index.js
10555067        tmp/arti/toolchain_old/doc/search-index.js
8921236 tmp/arti/toolchain_new/doc/search-index.js
77018   tmp/cortex-m/toolchain_old/doc/search-index.js
66676   tmp/cortex-m/toolchain_new/doc/search-index.js
2876330 tmp/sqlx/toolchain_old/doc/search-index.js
2436812 tmp/sqlx/toolchain_new/doc/search-index.js
63632890        tmp/stm32f4/toolchain_old/doc/search-index.js
52337438        tmp/stm32f4/toolchain_new/doc/search-index.js
631150  tmp/ripgrep/toolchain_old/doc/search-index.js
541646  tmp/ripgrep/toolchain_new/doc/search-index.js
```
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions