]> granicus.if.org Git - vim/commitdiff
patch 8.2.4553: linear tag search is a bit slow v8.2.4553
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 12 Mar 2022 17:38:29 +0000 (17:38 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 12 Mar 2022 17:38:29 +0000 (17:38 +0000)
Problem:    Linear tag search is a bit slow.
Solution:   Remove a vim_ftell() call. (Yegappan Lakshmanan, closes #9937)

src/tag.c
src/testdir/test_taglist.vim
src/version.c

index 45b3062deef5740676562bbe94f67645409a95b2..4cf11dc2263c4249833a6cb698bc986bcbe06514 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -2092,10 +2092,7 @@ findtags_get_next_line(findtags_state_T *st, tagsearch_info_T *sinfo_p)
                eof = cs_fgets(st->lbuf, st->lbuf_size);
            else
 #endif
-           {
-               sinfo_p->curr_offset = vim_ftell(st->fp);
                eof = vim_fgets(st->lbuf, st->lbuf_size, st->fp);
-           }
        } while (!eof && vim_isblankline(st->lbuf));
 
        if (eof)
@@ -2850,7 +2847,7 @@ line_read_in:
                return;
            }
 
-           if (st->state == TS_STEP_FORWARD)
+           if (st->state == TS_STEP_FORWARD || st->state == TS_LINEAR)
                // Seek to the same position to read the same line again
                vim_ignored = vim_fseek(st->fp, search_info.curr_offset,
                                                                     SEEK_SET);
index 04ca02decf766aaedb80b63e87f6588e62262915..23ef1078f37aa37bdd42d4750ec1211b03547b2f 100644 (file)
@@ -259,8 +259,15 @@ func Test_tag_complete_with_overlong_line()
   call writefile(tagslines, 'Xtags')
   set tags=Xtags
 
+  " try with binary search
+  set tagbsearch
   call feedkeys(":tag inbou\<C-A>\<C-B>\"\<CR>", 'xt')
   call assert_equal('"tag inboundGSV inboundGovernor inboundGovernorCounters', @:)
+  " try with linear search
+  set notagbsearch
+  call feedkeys(":tag inbou\<C-A>\<C-B>\"\<CR>", 'xt')
+  call assert_equal('"tag inboundGSV inboundGovernor inboundGovernorCounters', @:)
+  set tagbsearch&
 
   call delete('Xtags')
   set tags&
index acc5ccf6d6f9c5e475ba8a10cc557955e105bd34..0c90e2dab78f6abc2e55f2c1d5bdb0c12d774f58 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4553,
 /**/
     4552,
 /**/