- Cache the results of some scans, to improve performance in buffers
- containing very long lines.
- * region-cache.c, region-cache.h: New files.
- * Makefile.in.in (obj) Add region-cache.o to the list of files.
- (region-cache.o): New target.
- (buffer.o, indent.o, search.o): Depend on region-cache.h.
- * buffer.h (struct buffer): New members: newline_cache,
- width_run_cache, width_table, and cache_long_line_scans.
- * buffer.c: #include region-cache.h.
- (Fget_buffer_create): Initialize new members of struct buffer.
- (Fkill_buffer): Free memory occupied by caches.
- (init_buffer_once): Set default value for cache_long_line_scans in
- buffer_defaults, and give it a bit in buffer_local_flags.
- (syms_of_buffer): Add DEFVAR_PER_BUFFER for cache_long_line_scans.
- * insdel.c (prepare_to_modify_buffer): Invalidate width run and
- newline caches, if they exist.
- * search.c: #include "region-cache.h".
- (max, min): Make these functions, not macros; we'd like to pass
- them arguments that would be bad to evaluate more than once.
- (newline_cache_on_off): New function.
- (scan_buffer): New argument END. Call newline_cache_on_off. If
- this buffer's newline cache is enabled, consult it to see if we
- need to scan a region for newlines, and store information in the
- cache after doing so.
- (find_next_newline): Pass new arg to scan_buffer.
- (find_before_next_newline): New function.
- * cmds.c (Fforward_line): Call scan_buffer with new args.
- (Fend_of_line): Replace call to Fforward_line and search loop with
- call to find_before_next_newline.
- * syntax.c (find_defun_start): Call scan_buffer with new args.
- * indent.c: #include "region-cache.h".
- (character_width, disptab_matches_widthtab, recompute_width_table,
- width_run_cache_on_off): New functions.
- (compute_motion): Call width_run_cache_on_off. If this buffer's
- width run cache is enabled, consult it to see if we need to
- traverse a region character-by-character; store information in the
- cache after doing so. Call find_before_next_newline instead of
- writing out an equivalent loop explicitly, to take advantage of
- the newline cache.
- Doc fixes.
- * xdisp.c (redisplay_window): Invalidate width_run_cache, if the
- buffer's display table doesn't match the width table the cache was
- built for.
- (display_text_line): Use compute_motion to skip forward to the
- left edge of the window when the window is hscrolled; this is
- faster than rendering all the characters into the bit bucket when
- the hscroll is large.
- Doc fixes.
- (display_count_lines): Call scan_buffer with new args.
- * disptab.h (window_display_table): Doc fix.
- (buffer_display_table): New declaration.
- * indent.h (disptab_matches_widthtab, recompute_width_table): New
- declarations.
+ Cache the results of some scans, to improve performance in buffers
+ containing very long lines.
+ * region-cache.c, region-cache.h: New files.
+ * Makefile.in.in (obj) Add region-cache.o to the list of files.
+ (region-cache.o): New target.
+ (buffer.o, indent.o, search.o): Depend on region-cache.h.
+ * buffer.h (struct buffer): New members: newline_cache,
+ width_run_cache, width_table, and cache_long_line_scans.
+ * buffer.c: #include region-cache.h.
+ (Fget_buffer_create): Initialize new members of struct buffer.
+ (Fkill_buffer): Free memory occupied by caches.
+ (init_buffer_once): Set default value for cache_long_line_scans in
+ buffer_defaults, and give it a bit in buffer_local_flags.
+ (syms_of_buffer): Add DEFVAR_PER_BUFFER for cache_long_line_scans.
+ * insdel.c (prepare_to_modify_buffer): Invalidate width run and
+ newline caches, if they exist.
+ * search.c: #include "region-cache.h".
+ (max, min): Make these functions, not macros; we'd like to pass
+ them arguments that would be bad to evaluate more than once.
+ (newline_cache_on_off): New function.
+ (scan_buffer): New argument END. Call newline_cache_on_off. If
+ this buffer's newline cache is enabled, consult it to see if we
+ need to scan a region for newlines, and store information in the
+ cache after doing so.
+ (find_next_newline): Pass new arg to scan_buffer.
+ (find_before_next_newline): New function.
+ * cmds.c (Fforward_line): Call scan_buffer with new args.
+ (Fend_of_line): Replace call to Fforward_line and search loop with
+ call to find_before_next_newline.
+ * syntax.c (find_defun_start): Call scan_buffer with new args.
+ * indent.c: #include "region-cache.h".
+ (character_width, disptab_matches_widthtab, recompute_width_table,
+ width_run_cache_on_off): New functions.
+ (compute_motion): Call width_run_cache_on_off. If this buffer's
+ width run cache is enabled, consult it to see if we need to
+ traverse a region character-by-character; store information in the
+ cache after doing so. Call find_before_next_newline instead of
+ writing out an equivalent loop explicitly, to take advantage of
+ the newline cache.
+ Doc fixes.
+ * xdisp.c (redisplay_window): Invalidate width_run_cache, if the
+ buffer's display table doesn't match the width table the cache was
+ built for.
+ (display_text_line): Use compute_motion to skip forward to the
+ left edge of the window when the window is hscrolled; this is
+ faster than rendering all the characters into the bit bucket when
+ the hscroll is large.
+ Doc fixes.
+ (display_count_lines): Call scan_buffer with new args.
+ * disptab.h (window_display_table): Doc fix.
+ (buffer_display_table): New declaration.
+ * indent.h (disptab_matches_widthtab, recompute_width_table): New
+ declarations.