[PATCH] D59300: [clangd] Tune the fuzzy-matching algorithm

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 07:42:40 PDT 2019


ilya-biryukov created this revision.
ilya-biryukov added a reviewer: ioeric.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.
Herald added a project: clang.

It now gives less preference to prefix matches and does not penalize
skipping segments.

The motivation is producing better scoring in one particular example,
but the change does not seem to cause large regressions in other cases.

The examples is matching 'up' against 'unique_ptr' and 'upper_bound'.
Before the change, we had:

- "[u]nique_[p]tr" with a score of 0.3.
- "[up]per_bound" with a score of 1.0.

A 3x difference meant that symbol quality signals were almost always ignored
and 'upper_bound' was always ranked higher.

However, intuitively, the match scores should be very close for the two.
After the change both items match with a score of 1.0.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59300

Files:
  clang-tools-extra/clangd/FuzzyMatch.cpp
  clang-tools-extra/unittests/clangd/FuzzyMatchTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59300.190415.patch
Type: text/x-patch
Size: 4874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190313/c9407b42/attachment.bin>


More information about the cfe-commits mailing list