mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.1.0958: compiling weird regexp pattern is very slow
Problem: Compiling weird regexp pattern is very slow. Solution: When reallocating post list increase size by 50%. (Kuang-che Wu, closes #4012) Make assert_inrange() accept float values.
This commit is contained in:
@@ -509,10 +509,13 @@ nfa_get_match_text(nfa_state_T *start)
|
||||
realloc_post_list(void)
|
||||
{
|
||||
int nstate_max = (int)(post_end - post_start);
|
||||
int new_max = nstate_max + 1000;
|
||||
int new_max;
|
||||
int *new_start;
|
||||
int *old_start;
|
||||
|
||||
// For weird patterns the number of states can be very high. Increasing by
|
||||
// 50% seems a reasonable compromise between memory use and speed.
|
||||
new_max = nstate_max * 3 / 2;
|
||||
new_start = (int *)lalloc(new_max * sizeof(int), TRUE);
|
||||
if (new_start == NULL)
|
||||
return FAIL;
|
||||
|
Reference in New Issue
Block a user