Subject: bug#73592: 30.0.91; delayed output with completion preview mode

From: Christopher Howard <[email-masked]>
Date: Wed, 02 Oct 2024 09:11:08 -0800

Hi, I tried the trick with pressing C-g during the delay. But what happen is pressing C-g causes the character to immediately be outputted, and then the quit occurs while nothing is happening.

Here is the memory profile report, focusing on the completion-preview functions:

```
     19,164,570  72% + command-execute
      7,380,749  27% - completion-preview--post-command
      7,378,491  27%  - completion-preview--show
      7,378,491  27%   - completion-preview--try-update
      7,378,491  27%    - completion-preview--update
      7,378,491  27%     - run-hook-wrapped
      7,378,491  27%      - completion-preview--capf-wrapper
      7,335,593  27%       - completion-preview--try-table
      7,322,689  27%        - completion-all-completions
      7,322,689  27%         - completion--nth-completion
      7,248,585  27%          - #<byte-code-function 080>
      7,248,585  27%           - completion--twq-all
      7,246,553  27%            - mapcar
      7,246,553  27%             - #<byte-code-function 011>
      6,578,265  24%              - comint-quote-filename
      6,577,241  24%               - regexp-opt-charset
      2,700,117  10%                - map-char-table
      2,700,117  10%                 - #<byte-code-function 7FA>
      2,410,674   9%                    format
        609,168   2%                  make-char-table
        218,980   0%                  format
          1,024   0%                 string-match
          2,032   0%            + comint--requote-argument
         73,088   0%          + seq-some
          1,016   0%          + #<byte-code-function 39F>
         11,888   0%        + minibuffer--sort-by-length-alpha
         42,898   0%       + pcomplete-completions-at-point
          2,258   0%  + completion-preview-require-minimum-symbol-length
         20,967   0%   Automatic GC
         12,400   0%   redisplay_internal (C function)
              0   0%   ...
```

And here is the CPU report:

```
        1318  53% + command-execute
         932  37%   Automatic GC
         200   8% - completion-preview--post-command
         200   8%  - completion-preview--show
         200   8%   - completion-preview--try-update
         200   8%    - completion-preview--update
         200   8%     - run-hook-wrapped
         200   8%      - completion-preview--capf-wrapper
         184   7%       - completion-preview--try-table
         180   7%        - completion-all-completions
         180   7%         - completion--nth-completion
          92   3%          - #<byte-code-function 080>
          92   3%           - completion--twq-all
          92   3%            - mapcar
          88   3%             - #<byte-code-function 011>
          80   3%              - comint-quote-filename
          80   3%               - regexp-opt-charset
          24   0%                - map-char-table
          16   0%                 - #<byte-code-function 43C>
          16   0%                    format
           4   0%                  format
          88   3%          - seq-some
          88   3%           - seq-do
          88   3%            - mapc
          88   3%             - #<byte-code-function 0BE>
          88   3%              - #<byte-code-function 0AF>
          88   3%               - completion-basic-all-completions
          88   3%                - completion-pcm--all-completions
          88   3%                 - all-completions
          88   3%                  - #<byte-code-function 3C8>
          88   3%                   - #<byte-code-function 3E2>
          68   2%                      all-completions
          12   0%                      file-name-all-completions
           8   0%                    - pcomplete-uniquify-list
           8   0%                     - sort
           4   0%                        #<primitive-function string-lessp>
           4   0%        + minibuffer--sort-by-length-alpha
          16   0%       + pcomplete-completions-at-point
          28   1% + redisplay_internal (C function)
           4   0% + timer-event-handler
           0   0%   ...
```

-- 
Christopher Howard