Skip to content

Faster elfeed-search-update#440

Open
shitikanth wants to merge 3 commits intoskeeto:masterfrom
shitikanth:faster-update
Open

Faster elfeed-search-update#440
shitikanth wants to merge 3 commits intoskeeto:masterfrom
shitikanth:faster-update

Conversation

@shitikanth
Copy link

Save the value of the corresponding elfeed-entry in text-property and
only call elfeed-search-print-entry-function when the entry has changed
or we have encountered a new entry.

On my system, with ~7000 elfeed-search-entries this reduces the time of
elfeed-search-update with a small number of changes from ~0.70s to ~0.03s.

Save the value of the corresponding elfeed-entry in text-property and
only call elfeed-search-print-entry-function when the entry has changed
or we have encountered a new entry.
@shitikanth
Copy link
Author

In current state, if window-width or any parameter for the elfeed-search-print-entry-function has changed in the meantime, the un-updated rows and updated rows will look inconsistent. For such a situation, I have added an option for a 'reset argument which clears the buffers before proceeding.

Copy link
Contributor

@alphapapa alphapapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, I'm not Chris, but maybe I can save him a little time by suggesting a few things.

In addition to the specific comments, please untabify your changes and be sure they are indented properly, because several of these forms aren't.

elfeed-search.el Outdated
(insert (propertize feed-title 'face 'elfeed-search-feed-face) " "))
(when tags
(insert "(" tags-str ")"))
(add-text-properties
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably use put-text-property here, since you're only setting one property.

elfeed-search.el Outdated
(move-to-column column)))))

(defun elfeed-search-update (&optional force)
(defun elfeed-entries-compare (entry-a entry-b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reorder these functions so the diff can be more cleanly read (see how it shows the elfeed-search-update function's first line being replaced, but the new line is far below it in the diff).

elfeed-search.el Outdated
(let ((inhibit-read-only t)
(standard-output (current-buffer))
(sorter (or elfeed-search-sort-function #'elfeed-entries-compare)))
(when reset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to have both force and reset flags?

elfeed-search.el Outdated
(while
(let ((saved-entry (get-text-property (point) 'saved-elfeed-entry)))
(cond
;; no change in entry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is a bit redundant, considering the simple equal... below. :)

elfeed-search.el Outdated
((equal entry saved-entry)
(forward-line 1)
nil)
;; saved-entry sorts after entry, insert and moved on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not very clear. Could you rewrite it as a sentence?

elfeed-search.el Outdated
(funcall elfeed-search-print-entry-function entry)
(insert "\n")
nil)
;; found an entry that sorts before id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment could be more succinct, like "Entry sorts before ID: delete it."

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants