summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-03-12 17:38:29 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-12 17:38:29 +0000
commit8b530b3158cbd3aee2ad9cad8e7b7964faabb51e (patch)
tree99b0896116b563eac5c2712e68fab6f7d78f4ba7
parentd0b7bfa95798f5ec743d8afffbffb83aeac823da (diff)
patch 8.2.4553: linear tag search is a bit slowv8.2.4553
Problem: Linear tag search is a bit slow. Solution: Remove a vim_ftell() call. (Yegappan Lakshmanan, closes #9937)
-rw-r--r--src/tag.c5
-rw-r--r--src/testdir/test_taglist.vim7
-rw-r--r--src/version.c2
3 files changed, 10 insertions, 4 deletions
diff --git a/src/tag.c b/src/tag.c
index 45b3062dee..4cf11dc226 100644
--- 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);
diff --git a/src/testdir/test_taglist.vim b/src/testdir/test_taglist.vim
index 04ca02decf..23ef1078f3 100644
--- a/src/testdir/test_taglist.vim
+++ b/src/testdir/test_taglist.vim
@@ -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&
diff --git a/src/version.c b/src/version.c
index acc5ccf6d6..0c90e2dab7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4553,
+/**/
4552,
/**/
4551,