Files
neovim/src/nvim
zeertzjq 34288b3eec vim-patch:9.2.0339: regexp: nfa_regmatch() allocates and frees too often (#38996)
Problem:  nfa_regmatch() allocates and frees two list buffers on every
          call, causing unnecessary memory allocation overhead for
          frequently used patterns.
Solution: Cache the list buffers in the regprog struct and reuse them
          on subsequent top-level calls. Recursive calls still allocate
          their own buffers. Free cached buffers in nfa_regfree()
          (Yasuhiro Matsumoto).

Benchmark: 10K lines, `:%s` x50 iterations

| Pattern | Before | After | Improvement |
|---|---|---|---|
| `\<\(\w\+\%(ing\|tion\|ed\|ly\)\|\w\{3,}\)\>` (many matches) | 4.384s | 4.299s | -2% |
| `\(foo\|bar\|baz\)\{3,}\(qux\|quux\|corge\)\{2,}...` (no match, high nstate) | 16.927s | 3.015s | -82% |

closes: vim/vim#19956

105d65e29b

Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-04-13 07:30:32 +08:00
..
2026-04-10 11:08:26 -05:00
2026-04-10 11:08:26 -05:00
2026-04-12 14:17:50 +02:00
2026-04-10 11:08:26 -05:00
2024-01-11 21:37:23 +01:00
2026-03-11 18:00:18 +01:00
2026-03-11 18:00:18 +01:00
2024-01-11 21:37:23 +01:00
2025-12-15 13:55:15 -05:00
2023-11-28 22:23:56 +01:00
2026-04-12 14:17:50 +02:00
2024-01-11 21:37:23 +01:00
2026-02-12 13:46:45 +01:00
2026-03-29 11:56:37 -04:00
2026-04-12 08:45:46 -04:00
2025-11-16 20:36:07 -08:00
2024-01-11 21:37:23 +01:00
2024-01-11 21:37:23 +01:00
2026-03-29 11:56:37 -04:00
2025-09-13 22:49:50 -04:00
2024-01-11 21:37:23 +01:00
2025-12-06 20:33:02 -05:00
2026-04-11 09:12:58 -04:00
2025-11-19 20:43:15 -08:00
2026-03-28 09:59:54 -04:00