-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncating is too slow for long buffers #74
Comments
Could you add some more context/steps to reproduce? And by "long" do you mean processes with a lot of output or a large truncation setting? (I've found that processes with a lot of output are too slow with or without truncation, due to Emacs' text-handling.) |
I think it's due to the redisplay being called and having to rework large parts of the buffer line removed.. For the time being, I'm using this: (setq my-prodigy-truncate-amount 5000
my-prodigy-truncate-threshold 15000)
;; NOTE overriden
(defun prodigy-truncate-buffer (service _)
"Truncate SERVICE process view buffer to its maximum size."
(prodigy-with-service-process-buffer service
(when (> (line-number-at-pos (point-max)) my-prodigy-truncate-threshold)
(save-excursion
(goto-char (point-min))
(forward-line my-prodigy-truncate-amount)
(delete-region (point-min) (point)))))) By truncating only at every 5000th lines emacs is almost usable since it only freezes up a short time at every truncation. I think i might add that I also have compilation-minor-mode enabled for the output buffers which adds quite a few regexps which I guess affects redisplay time. |
I can reproduce by just hitting the max lines while having the log buffer visible and for any added (truncated) line emacs stops for ~ 200-600ms. Insertion only seems to give real slown downs somewhere around 70-100k lines on my computer. |
An intentionally extreme example where the threshold really help: https://www.youtube.com/watch?v=jk5iCkQcYQI The freezing seen at every 5000th line in the video feels only slightly longer than the freeze for each line with the default truncation code. Having multiplication in mind the total effect is large. |
Deleting chunks would probably be better.. Maybe using threshold/amount instead of a maximum value.
The slowdown happens if the buffer is visible only.
The text was updated successfully, but these errors were encountered: