[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs qe.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs qe.c |
Date: |
Sun, 16 Aug 2015 18:01:06 +0000 |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 15/08/16 18:01:06
Modified files:
. : qe.c
Log message:
search: 10x speed improvement on large files
- do_center_window used to be very inefficient when invoked with point
at a great distance from the current window. This was slowing down
successful searches on large files by a factor of 10 or more.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.199&r2=1.200
Patches:
Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -b -r1.199 -r1.200
--- qe.c 16 Aug 2015 17:52:14 -0000 1.199
+++ qe.c 16 Aug 2015 18:01:06 -0000 1.200
@@ -1166,8 +1166,14 @@
if (!s->mode->text_display)
return;
- if (s->offset < s->offset_top) {
- int offset_top = s->offset_top;
+ if (s->offset < s->offset_top
+ || (s->offset_bottom >= 0 && s->offset >= s->offset_bottom)) {
+ /* if point is outside the current window, first move the
+ * window to start at the line with point. This significantly
+ * speeds up get_cursor_pos() on large files, except for the
+ * pathological case of huge lines.
+ */
+ int offset_top = s->offset;
eb_prevc(s->b, offset_top, &offset_top);
s->offset_top = s->mode->text_backward_offset(s, offset_top);
}