radian-software / prescient.el

☄️ Simple but effective sorting and filtering for Emacs.
MIT License
603 stars 25 forks source link

Only add properties for `prescient-sort-full-matches-first` to the first candidate. #148

Closed okamsn closed 1 year ago

okamsn commented 1 year ago

Only add properties to the first candidate, and search for the properties in the candidates list. This should be better than what we do now, which is to propertize every candidate and later get the properties from the first candidate in the list.

For N candidates, the old way is always

(propertize N) + (search 1) + (sort N)

and the new way is

(propertize 1) + (search (N - x)) + (sort N)

where x is greater than or equal to 0. Assuming that get-text-property is no worse than propertize (which seems true in testing), the new way is never worse than the old way, and should usually be better.