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/drawscreen.c b/src/drawscreen.c
index ed89271..2c184bd 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -1474,9 +1474,6 @@
#if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
int save_got_int;
#endif
-#ifdef SYN_TIME_LIMIT
- proftime_T syntax_tm;
-#endif
#if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
// This needs to be done only for the first window when update_screen() is
@@ -2182,8 +2179,7 @@
#endif
#ifdef SYN_TIME_LIMIT
// Set the time limit to 'redrawtime'.
- profile_setlimit(p_rdt, &syntax_tm);
- syn_set_timeout(&syntax_tm);
+ init_regexp_timeout(p_rdt);
#endif
#ifdef FEAT_FOLDING
win_foldinfo.fi_level = 0;
@@ -2695,7 +2691,7 @@
}
#ifdef SYN_TIME_LIMIT
- syn_set_timeout(NULL);
+ disable_regexp_timeout();
#endif
// Reset the type of redrawing required, the window has been updated.