0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.5057: using gettimeofday() for timeout is very inefficient

Problem:    Using gettimeofday() for timeout is very inefficient.
Solution:   Set a platform dependent timer. (Paul Ollis, closes #10505)
This commit is contained in:
Paul Ollis
2022-06-05 16:55:54 +01:00
committed by Bram Moolenaar
parent 1d97db3d98
commit 6574577cac
29 changed files with 811 additions and 242 deletions

View File

@@ -266,9 +266,6 @@ static reg_extmatch_T *next_match_extmatch = NULL;
static win_T *syn_win; // current window for highlighting
static buf_T *syn_buf; // current buffer for highlighting
static synblock_T *syn_block; // current buffer for highlighting
#ifdef FEAT_RELTIME
static proftime_T *syn_tm; // timeout limit
#endif
static linenr_T current_lnum = 0; // lnum of current state
static colnr_T current_col = 0; // column of current state
static int current_state_stored = 0; // TRUE if stored current state
@@ -350,18 +347,6 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci);
static int get_id_list(char_u **arg, int keylen, short **list, int skip);
static void syn_combine_list(short **clstr1, short **clstr2, int list_op);
#if defined(FEAT_RELTIME) || defined(PROTO)
/*
* Set the timeout used for syntax highlighting.
* Use NULL to reset, no timeout.
*/
void
syn_set_timeout(proftime_T *tm)
{
syn_tm = tm;
}
#endif
/*
* Start the syntax recognition for a line. This function is normally called
* from the screen updating, once for each displayed line.
@@ -3166,9 +3151,7 @@ syn_regexec(
syn_time_T *st UNUSED)
{
int r;
#ifdef FEAT_RELTIME
int timed_out = FALSE;
#endif
#ifdef FEAT_PROFILE
proftime_T pt;
@@ -3183,13 +3166,7 @@ syn_regexec(
return FALSE;
rmp->rmm_maxcol = syn_buf->b_p_smc;
r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col,
#ifdef FEAT_RELTIME
syn_tm, &timed_out
#else
NULL, NULL
#endif
);
r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, &timed_out);
#ifdef FEAT_PROFILE
if (syn_time_on)