Open jedwards1211 opened 5 years ago
Thanks @jedwards1211 - @t9md if you find something specific in your investigation that you think the team should take a look at and it's not something you can resolve in vim-mode-plus, please let us know.
Investigated quickly.
vim-mode-plus depends on editor.scanInBufferRange
and editor.backwardsScanInBufferRange
heavily.
These function call TextBuffer's scanInRange
internally.
The problem is although scanInBufferRange
accept iterator which stops scanning at the given condition it collects all matching entries unnecessarily by calling findAllInRangeSync
.
https://github.com/atom/text-buffer/blob/master/src/text-buffer.js#L1536
Maybe I believe the original assumption is findAllInRangeSync
is fast enough for us to ignore this inefficiency.
But here, when scanRange
become very big like 60K lines of buffer.
This inefficiency becomes significant.
I want text-buffer provide checking iterator line by line instead of preliminarily collect all entries then checking iterator.
What I can come up with to overcome current limitation is to implement own version of editor.scanInRange
, but I don't think it is an ideal solution.
See https://github.com/t9md/atom-vim-mode-plus/issues/1113.
Basically, it's
TextBuffer
's fault.TextBuffer.findAllInRangeSync
is going super slow at the beginning of the file. Considering this and issues with find in replace in large files being really slow, it's obvious thatTextBuffer
needs some serious improvement.Edit by @rsese to copy the detailed issue description from https://github.com/t9md/atom-vim-mode-plus/issues/1113