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)
diff --git a/src/syntax.c b/src/syntax.c
index 6b71e8d..679b99d 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -266,9 +266,6 @@
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 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_time_T *st UNUSED)
{
int r;
-#ifdef FEAT_RELTIME
int timed_out = FALSE;
-#endif
#ifdef FEAT_PROFILE
proftime_T pt;
@@ -3183,13 +3166,7 @@
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)