Vim complexity bug with joining lots of lines

Lee Naish lee at csse.unimelb.edu.au
Tue Dec 9 00:12:15 UTC 2008


The "J" command seems to have a complexity bug when given a large numeric
argument, eg 100000J

eg:

%  yes | head -100000 > vimtest
%  time vim vimtest

<Joined all lines using 99999J>

17.2u 0.0s 2:29.74 11.5% 0+0k 0+10232io 0pf+0w
% yes | head -200000 > vimtest
%  time vim vimtest

<Joined all lines using 199999J>

68.8u 0.4s 1:41.22 68.3% 0+0k 0+39648io 0pf+0w

ie, doubling the number of lines increased the runtime by a factor of 4
exactly - seems like there is a O(N^2) component to the algorithm.

	lee



More information about the pkg-vim-maintainers mailing list