From 29db7b63ac663b9c14d0cfbfeb971a6ca9b8b01a Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Tue, 19 Jul 2022 00:24:09 +0100 Subject: [PATCH] feat(editor/fussy): improve completion performance It seems the fzf-native scoring method can get slow and laggy over time. It seems the flx-rs method does not, and is overall a bit faster. However, flx-rs doesn't give exact matches as high of a score as fzf-native, so scoring might be a bit different than I'm used to. Time will tell if I'll find it annoying enough to switch back to fzf-native. Also switch from orderless to fussy's all-completions backed filtering method. This yields a noticeable improvement in speed, but it does not support multiple search terms separated by space like orderless does. Another potential habit I will need to adjust. --- modules/editor/siren-fussy.el | 36 +++++++++++++++++++++++++---------- straight/versions/default.el | 3 +-- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/modules/editor/siren-fussy.el b/modules/editor/siren-fussy.el index 35f06d1..55af804 100644 --- a/modules/editor/siren-fussy.el +++ b/modules/editor/siren-fussy.el @@ -6,16 +6,39 @@ ;;; Code: +;; (use-package orderless +;; :commands (orderless-filter)) + +;; (use-package fzf-native +;; :straight (fzf-native :repo "dangduc/fzf-native" :host github +;; :files (:defaults "bin")) +;; :config +;; (fzf-native-load-dyn)) + +(use-package flx-rs + :straight (flx-rs :repo "jcs-elpa/flx-rs" :fetcher github + :files (:defaults "bin")) + :config + (flx-rs-load-dyn)) + (use-package fussy - :ensure t + :demand t :custom (completion-category-overrides nil) (completion-ignore-case t) (pcomplete-ignore-case t) (fussy-ignore-case t) - (fussy-filter-fn 'fussy-filter-orderless-flex) - (fussy-score-fn 'fussy-fzf-native-score) + + (fussy-filter-fn + 'fussy-filter-default + ;; 'fussy-filter-orderless-flex + ) + + (fussy-score-fn + ;; 'fussy-fzf-native-score + 'flx-rs-score + ) :preface (defun siren-fussy--company-transform-advice (f &rest args) @@ -29,14 +52,7 @@ :around 'siren-fussy--company-transform-advice) (setq completion-category-defaults nil)) -(use-package orderless - :commands (orderless-filter)) -(use-package fzf-native - :straight (fzf-native :repo "dangduc/fzf-native" :host github - :files (:defaults "bin")) - :config - (fzf-native-load-dyn)) (provide 'siren-fussy) ;;; siren-fussy.el ends here diff --git a/straight/versions/default.el b/straight/versions/default.el index b144530..77c8904 100644 --- a/straight/versions/default.el +++ b/straight/versions/default.el @@ -72,6 +72,7 @@ ("fbthrift" . "52c465de9b6ed37de55ace97d2ceb95a177543cf") ("flutter.el" . "b4148db1e6e6822a6a0da1eda3c58affe562d1dc") ("flx" . "e3b3f0533e44c5250ce73d728b59a7e96c692b5d") + ("flx-rs" . "08156fe15c28a5fd9ef1975ba3a11de26226c90e") ("flycheck" . "c955fd6fb970eed5fdecf675369d3d61a41f6c68") ("flycheck-package" . "615c1ed8c6fb7c73abec6aaa73d3fef498d231bc") ("flycheck-rust" . "a139cd53c5062697e9ed94ad80b803c37d999600") @@ -79,7 +80,6 @@ ("forge" . "ed8abdafd8b15852538bbe064fef037345772627") ("frame-local" . "7ee1106c3bcd4022f48421f8cb1ef4f995da816e") ("fussy" . "314280ae62a907004ce82f8bbbddf8feca497e95") - ("fzf-native" . "1306de74712e550fabd7c1d8989f556cbbc56a22") ("gcmh" . "0089f9c3a6d4e9a310d0791cf6fa8f35642ecfd9") ("general.el" . "9651024e7f40a8ac5c3f31f8675d3ebe2b667344") ("gh-notify" . "aa4d8bc0c56366d437e7c126e7eedc5938109342") @@ -151,7 +151,6 @@ ("ob-go" . "2067ed55f4c1d33a43cb3f6948609d240a8915f5") ("ob-http" . "b1428ea2a63bcb510e7382a1bf5fe82b19c104a7") ("ob-mermaid" . "b4ce25699e3ebff054f523375d1cf5a17bd0dbaf") - ("orderless" . "8b9af2796fa0eb87eea4140bc08d16880a493803") ("osx-trash" . "af74a2055a15bf4182d8196600f7decd66eec634") ("ox-gfm" . "99f93011b069e02b37c9660b8fcb45dab086a07f") ("ox-pandoc" . "f8eac5e5692fc44a4724ada43191e7c28a1ccf30")