The previous recursive function repeatedly calls _update_lines() which is expensive. This makes my nvim freeze up even when working with smaller files; it's a terrible experience with larger files with a lot of symbol.
Changed it to an iterative algorithm and calling _update_lines() once at the end after the nodes have been updated. It should help with the memory usage too since the previous recursion wasn't tail call optimized.
The previous recursive function repeatedly calls
_update_lines()
which is expensive. This makes my nvim freeze up even when working with smaller files; it's a terrible experience with larger files with a lot of symbol.Changed it to an iterative algorithm and calling
_update_lines()
once at the end after the nodes have been updated. It should help with the memory usage too since the previous recursion wasn't tail call optimized.fixes https://github.com/simrat39/symbols-outline.nvim/issues/224