timc1/kbar

commandScore expensive calculation when action's .name or .keywords or .subtitle are longer

panchicore opened this issue · 2 comments

kbar/src/useMatches.tsx

Lines 192 to 195 in b4666e0

const score = commandScore(
[action.name, action.keywords, action.subtitle].join(" "),
throttledSearch
);

commandScore execution is slow when having matches with detailed descriptions on action.subtitle, when the description length is > 100 characters using the typing the command results in input lag. The use case is a text search in which resulting actions contain highlighted matches of the keyword match.

I am adding the actions with useRegisterActions after matches are found, maybe I should be using a different approach?

timc1 commented

Yep this is known! (#255) For now if absolutely needed, you can stub out command score or reduce the length of the compared word

@panchicore you can check if this fix your issue #325