Lee Naish wrote: > The "J" command seems to have a complexity bug when given a large numeric > argument, eg 100000J ... > 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.
The "=" command also has O(n^2) complexity: Here are some timing using the following test case... $ for lines in 1000 2000 4000 8000 16000 32000 ; do echo "=== $lines" yes | head -$lines > yes-$lines.txt /usr/bin/time vim -u NONE -c 'normal =G' -c 'q!' yes-$lines.txt done #lines timing 1000 0.25user 0.01system 0:00.33elapsed 79%CPU 2000 0.78user 0.04system 0:00.86elapsed 96%CPU 4000 2.91user 0.06system 0:03.30elapsed 90%CPU 8000 11.26user 0.24system 0:12.33elapsed 93%CPU 16000 46.47user 0.86system 0:47.83elapsed 98%CPU 32000 182.99user 3.76system 3:07.84elapsed 99%CPU I.e. indenting 2*n lines is ~ 4x longer than indenting n lines. -- Dominique --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---