Skip to content

Slow computation for 1M+ suggestions #23

Description

@aartaka

I've got this code in my Nyxt config:

(define-class unicode-source (prompter:source)
  ((prompter:name "Unicode character")
   (prompter:filter-preprocessor #'prompter:filter-exact-matches)
   (prompter:constructor (loop for i from 0
                               while (ignore-errors (code-char i))
                               collect (code-char i)))))

(defmethod prompter:object-attributes ((char character) (source unicode-source))
  `(("Character" ,(if (graphic-char-p char)
                      (princ-to-string char)
                      (format nil "~s" char)))
    ("Name" ,(char-name char))
    ("Code" ,(format nil "~D/~:*~X" (char-code char)))))

(define-command-global insert-unicode (&key (character (prompt :prompt "Character to insert"
                                                               :sources 'unicode-source)))
  "Insert the chosen Unicode character."
  (ffi-buffer-paste (string character)))

When running the command, I usualy wait some 3-7 seconds for it to load, and the scrolling/narrowing is terribly laggy. Would be nice to optimize something on the Prompter side to make it work :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions