rust/tests
Michael Howell 86da4be47f rustdoc: use a trie for name-based search
Preview and profiler results
----------------------------

Here's some quick profiling in Firefox done on the rust compiler docs:

- Before: https://share.firefox.dev/3UPm3M8
- After: https://share.firefox.dev/40LXvYb

Here's the results for the node.js profiler:

- https://notriddle.com/rustdoc-html-demo-15/trie-perf/index.html

Here's a copy that you can use to try it out. Compare it with [the nightly].
Try typing `typecheckercontext` one character at a time, slowly.

- https://notriddle.com/rustdoc-html-demo-15/compiler-doc-trie/index.html

[the nightly]: https://doc.rust-lang.org/nightly/nightly-rustc/

The fuzzy match algo is based on [Fast String Correction with
Levenshtein-Automata] and the corresponding implementation code in [moman]
and [Lucene]; the bit-packing representation comes from Lucene, but the
actual matcher is more based on `fsc.py`. As suggested in the paper, a
trie is used to represent the FSA dictionary.

The same trie is used for prefix matching. Substring matching is done with a
side table of three-character[^1] windows that point into the trie.

[Fast String Correction with Levenshtein-Automata]: https://github.com/tpn/pdfs/blob/master/Fast%20String%20Correction%20with%20Levenshtein-Automata%20(2002)%20(10.1.1.16.652).pdf
[Lucene]: https://fossies.org/linux/lucene/lucene/core/src/java/org/apache/lucene/util/automaton/Lev1TParametricDescription.java
[moman]: https://gitlab.com/notriddle/moman-rustdoc

User-visible changes
--------------------

I don't expect anybody to notice anything, but it does cause two changes:

- Substring matches, in the middle of a name, only apply if there's three
  or more characters in the search query.
- Levenshtein distance limit now maxes out at two. In the old version,
  the limit was w/3, so you could get looser matches for queries with
  9 or more characters[^1] in them.

[^1]: technically utf-16 code units
2024-11-13 12:04:46 -07:00
..
assembly Stabilize Arm64EC inline assembly 2024-11-10 17:43:46 +09:00
auxiliary Fix typo in tests/auxiliary/minicore.rs 2024-11-03 17:32:33 +09:00
codegen Rollup merge of #132702 - 1c3t3a:issue-132615, r=rcvalle 2024-11-12 23:26:41 +01:00
codegen-units
coverage coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
coverage-run-rustdoc coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
crashes Auto merge of #132943 - matthiaskrgr:rollup-164l3ej, r=matthiaskrgr 2024-11-12 08:15:38 +00:00
debuginfo Auto merge of #123550 - GnomedDev:remove-initial-arc, r=Noratrieb 2024-10-24 13:35:50 +00:00
incremental
mir-opt coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
pretty Add pretty, ui, and feature-gate tests for the enzyme/autodiff frontend 2024-10-11 20:38:43 +02:00
run-make Re-enable version-verbose-commit-hash run-make test 2024-11-10 16:28:54 +01:00
rustdoc Rollup merge of #132871 - lolbinarycat:rustdoc-heterogeneous-first-paragraph-85763, r=aDotInTheVoid 2024-11-10 19:12:26 -05:00
rustdoc-gui rustdoc-search: simplify rules for generics and type params 2024-10-30 12:27:48 -07:00
rustdoc-js rustdoc: use a trie for name-based search 2024-11-13 12:04:46 -07:00
rustdoc-js-std rustdoc: use a trie for name-based search 2024-11-13 12:04:46 -07:00
rustdoc-json Rename Receiver -> LegacyReceiver 2024-10-22 12:55:16 +00:00
rustdoc-ui Auto merge of #126597 - estebank:unicode-output, r=fmease 2024-11-11 00:00:58 +00:00
ui Rollup merge of #132938 - compiler-errors:ed2024-apit-sugg, r=chenyukang 2024-11-12 18:11:06 +01:00
ui-fulldeps Fix error message for direct usage of sess.opts.crate_types 2024-11-10 10:37:53 +00:00
COMPILER_TESTS.md