helm-occur is slow in *Packages* buffer

Created on 12 Jul 2017  路  7Comments  路  Source: emacs-helm/helm

Expected behavior

helm-occur is not so slow in *Packages* buffer.

Actual behavior from emacs-helm.sh if possible (See note at bottom)

In *Packages* buffer (created by list-packages), helm-occur is slow.
I guess this is because buffer-string is slow in *Packages* buffer. So it would be nice to add an option to use buffer-substring-no-properties instead.

Steps to reproduce (recipe)

  1. Run emacs-helm.sh.
  2. Evaluate
    (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
  3. Call helm-occur and type something (e.g. theme).

Backtraces if some (M-x toggle-debug-on-error)

There is no error.

Describe versions of helm, emacs, operating system etc.

helm-20170709.1054 installed from Melpa.
(emacs-version) is
GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-07-11.
OS is Ubuntu 17.04. CPU is Core i5-5200U CPU @ 2.20GHz

All 7 comments

Sho Takemori notifications@github.com writes:

Expected behavior

helm-occur is not so slow in Packages buffer.

Actual behavior from emacs-helm.sh if possible (See note at bottom)

In Packages buffer (created by list-packages), helm-occur is slow.
I guess this is because buffer-string is slow in Packages buffer. So
it would be nice to add an option to use
buffer-substring-no-properties instead.

I think it is ok to use inconditionally
buffer-substring-no-properties, the only thing we loose is the
fontication of lines (when the matched buffer part have been jit-locked)
so it is not really a problem (after all grep and friends are showing
lines not highlighted and it is not annoying).

Thanks, should be slighly faster now!

--
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8 5FC2 28D1 7F53 59F2 9997

If I understand this correctly, I'm not sure this is a good change to make unconditionally. For example, if the user is looking at a source-code buffer, he'll probably want the fontification preserved.

alphapapa notifications@github.com writes:

If I understand this correctly, I'm not sure this is a good change to
make unconditionally. For example, if the user is looking at a
source-code buffer, he'll probably want the fontification preserved.

Yes, it's what I mentionned in previous post, but the fontification will
happen only starting at the maximum position jit-lock have fontified
buffer, so all results will be only fontified if the whole buffer have
been visited.
Using buffer-string initially was only for this purpose but I guess
having something faster is better than having fontification in
helm-buffer (if one use follow-mode he can see the syntax highlighted in
other buffer).
But well if you and others REALLY want this I can add a user var ;-).

--
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8 5FC2 28D1 7F53 59F2 9997

@thierryvolpiatto, thank you for quick response. By the way, I suspect this is a bug of Emacs. (buffer-string) in *Packages* buffer is too slow.
(benchmark-run 10 (buffer-string)) in *Packages* buffer is (1.335558024 10 1.0118128839999994) and that of (buffer-substring-no-properties (point-min) (point-max)) is (0.001285682 0 0.0).

Sho Takemori notifications@github.com writes:

@thierryvolpiatto, thank you for quick response. By the way, I suspect
this is a bug of Emacs. (buffer-string) in Packages buffer is too
slow. (benchmark-run 10 (buffer-string)) in Packages buffer is
(1.335558024 10 1.0118128839999994) and that of
(buffer-substring-no-properties (point-min) (point-max)) is
(0.001285682 0 0.0).

The packages buffer is a special case as it use tabulated-list, each
package (line) contains huge properties (a big vector among other
things), this is maybe the reason why buffer-string is long to compute.

BTW you have better time to use M-x helm-list-elisp-packages or M-x
helm-list-elisp-packages-no-fetch instead of list-packages + helm-occur.

--
Thierry
Gpg Key fingerprint = 6CEC 7081 AB33 E251 4AB8 5FC2 28D1 7F53 59F2 9997

BTW you have better time to use M-x helm-list-elisp-packages or M-x
helm-list-elisp-packages-no-fetch instead of list-packages + helm-occur.

Thanks. They are much faster.

Now it is customizable through helm-moccur-show-buffer-fontification.
Closing now.
Thanks.

Was this page helpful?
0 / 5 - 0 ratings