4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When using syntax folding, opening a file slows down a lot when
12 it's size increases by only 20%. (Gary Johnson)
13 Solution: The array with cached syntax states is leaking entries. After
14 cleaning up the list obtain the current entry again.
18 *** ../vim-6.2.100/src/syntax.c Sun Aug 10 14:52:30 2003
19 --- src/syntax.c Sat Sep 27 17:03:24 2003
23 /* When shrinking the array, cleanup the existing stack.
24 * Make sure that all valid entries fit in the new array. */
25 ! while (syn_buf->b_sst_len - syn_buf->b_sst_freecount + 2> len
26 && syn_stack_cleanup())
28 if (len < syn_buf->b_sst_len - syn_buf->b_sst_freecount + 2)
31 /* When shrinking the array, cleanup the existing stack.
32 * Make sure that all valid entries fit in the new array. */
33 ! while (syn_buf->b_sst_len - syn_buf->b_sst_freecount + 2 > len
34 && syn_stack_cleanup())
36 if (len < syn_buf->b_sst_len - syn_buf->b_sst_freecount + 2)
42 ! /* find the entry just before this one */
43 ! for (p = syn_buf->b_sst_first; p != NULL; p = p->sst_next)
44 ! if (p->sst_next == sp)
47 ! p->sst_next = sp->sst_next;
49 syn_buf->b_sst_first = sp->sst_next;
50 syn_stack_free_entry(syn_buf, sp);
57 ! /* find "sp" in the list and remove it */
58 ! if (syn_buf->b_sst_first == sp)
59 ! /* it's the first entry */
60 syn_buf->b_sst_first = sp->sst_next;
63 + /* find the entry just before this one to adjust sst_next */
64 + for (p = syn_buf->b_sst_first; p != NULL; p = p->sst_next)
65 + if (p->sst_next == sp)
67 + p->sst_next = sp->sst_next;
69 syn_stack_free_entry(syn_buf, sp);
76 /* If no free items, cleanup the array first. */
77 if (syn_buf->b_sst_freecount == 0)
79 (void)syn_stack_cleanup();
80 + /* "sp" may have been moved to the freelist now */
81 + sp = syn_stack_find_entry(current_lnum);
83 /* Still no free items? Must be a strange problem... */
84 if (syn_buf->b_sst_freecount == 0)
86 *** ../vim-6.2.100/src/version.c Sat Sep 27 19:20:53 2003
87 --- src/version.c Sat Sep 27 19:24:52 2003
91 { /* Add new patch number below this line */
97 Have you heard about the new Beowulf cluster? It's so fast, it executes
98 an infinite loop in 6 seconds.
100 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
101 /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
102 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
103 \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///