Lee Naish wrote:

> 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.


Confirmed with vim-7.2.65 on Linux.
Using the following script...

$ for s in 10000 20000 40000 60000 80000 100000 120000 140000 160000
  do
    yes | head -$s > /tmp/yes.tmp
    echo "=== joining $s lines..."
    time vim -u NONE -c '%join|q!' /tmp/yes.tmp
  done

... I get the following timing for joining lines:

  #lines  real time (sec)
   10000  0.417
   20000  1.355
   40000  4.686
   60000  10.391
   80000  18.110
  100000  28.377
  120000  40.394
  140000  54.943
  160000  71.499

Clearly timing does not increase linearly with the number of
lines as one would expect.


> I've checked out a copy under SVN, found the O(N^2) code and hacked up
> a possible fix, but haven't been able to test it because I have some
> shared library problem - I can create vim7/src/vim but when I run it
> (even the original version) I get:
>
> ld.so.1: vim: fatal: libintl.so.3: open failed: No such file or directory
> Killed
>
> We have /local/solaris86/lib/libintl.so.3 but in /usr/lib there is no ".3"
> version.  We used to have good sysadmin support, but no longer...
>
> Do you suggest I
>
> a) Keep stuffing around here on my own (I could copy everything to my laptop
> running Ubuntu I guess).  Any suggestions welcome...
>
> b) Post the (untested) code here (there isn't much and it needs some
> cleaning up and checking by someone more familiar with Vim anyway).
>
>        lee

I let you decide :-)  Building vim on Ubuntu is simple:

# Install the required packages to be able to build vim
$ sudo apt-get build-dep vim-full

# download the sources
$ cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/vim checkout  vim7

# then build
$ cd vim7
$ ./configure --with-features=huge
$ make
$ sudo make install

-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui