mate-desktop / atril

A document viewer for MATE
http://www.mate-desktop.org
GNU General Public License v2.0
198 stars 62 forks source link

ev-sidebar-links: Optimize reverse link lookup for a page #530

Closed ch-f closed 3 years ago

ch-f commented 3 years ago

Commit adapted for atril, picked up from: https://gitlab.gnome.org/GNOME/evince/-/commit/c3de8e75d6d0920478af210ba19a2d94b0734917

Credits to Benjamin Berg bberg@redhat.com

For large documents the linear search for the first link that is on a certain page is really slow. Because of this scrolling becomes slow whenever the page changes.
Replace the linear search with a search in a binary tree populated with
the first link on each page and the corresponding GtkTreePath. This way
a specialized binary tree lookup can be used to find the closest
matching link and select that in the treeview.
https://bugzilla.gnome.org/show_bug.cgi?id=779614