Hi
Things worth trying:
- What's the speed when running Vim with: vim -u NONE
(to rule out anything unexpected hat could be done by a plugin)
- How is the time difference with small files vs large files?
Is the speed difference proportional to the file size? Or is
there a constant slow down regardless of the file size?
It might be a combination of both.
It would be useful to have a graph showing write time vs file
size when using Vim and Notepad.
- things worth trying to check if they help:
:set noswapfile
:set nobackup
:set nowritebackup
:set nofsync
I tried running Vim with strace on Linux (I don't know any
equivalent on Windows XP) and I see that Vim writes the
file by chunks of 8192 bytes (which sounds reasonable to
me). It corresponds to BUFSIZE macro in src/fileio.c:
#define BUFSIZE 8192 /* size of normal write buffer */
I wonder whether making BUFSIZE bigger could help.
If you can recompile Vim, it might be worth trying to replace
BUFSIZE with something bigger (as an experiment) such as:
#define BUFSIZE 1024*32 /* size of normal write buffer */
Other things I see with strace:
- before writing file, Vim stats the file 4 times (not sure why
4 times are needed). For example I did ":w! /tmp/foo.txt" and
strace -r shows:
...snip...
0.000091 chdir("/tmp") = 0
0.000101 getcwd("/tmp", 4096) = 5
0.000094 fchdir(6) = 0
0.000086 close(6) = 0
!!! 0.000097 stat64("/tmp/foo.txt", {st_mode=S_IFREG|0644,
st_size=423510, ...}) = 0
0.000185 open(".", O_RDONLY|O_LARGEFILE) = 6
0.000097 fchdir(6) = 0
0.000085 chdir("/tmp") = 0
0.000096 getcwd("/tmp", 4096) = 5
0.000092 fchdir(6) = 0
0.000083 close(6) = 0
!!! 0.000090 stat64("/tmp/foo.txt", {st_mode=S_IFREG|0644,
st_size=423510, ...}) = 0
0.000345 stat64("/tmp/foo.txt", {st_mode=S_IFREG|0644,
st_size=423510, ...}) = 0
0.000191 readlink("/tmp/foo.txt", 0xbf836fe4, 4095) = -1 EINVAL
(Invalid argument)
!!! 0.000125 stat64("/tmp/.foo.txt.swp", 0xbf837f88) = -1 ENOENT (No
such file or directory)
0.000180 write(1, "\33[?25l\"/tmp/foo.txt\" \33[34;16H\33[K", 32) = 32
!!! 0.000133 stat64("/tmp/foo.txt", {st_mode=S_IFREG|0644,
st_size=423510, ...}) = 0
0.000178 access("/tmp/foo.txt", W_OK) = 0
0.000206 getxattr("/tmp/foo.txt", "system.posix_acl_access",
0xbf838f10, 132) = -1 EOPNOTSUPP (Operation not supported)
0.000209 open("/tmp/foo.txt",
O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0644) = 6
... and then follow a bunch of writes of 8192 bytes on file
descriptor 6 (/tmp/foo.txt)...
0.000384 fsync(6) = 0
0.024673 close(6) = 0
Cheers
-- Dominique
...snip...
> I tried running Vim with strace on Linux (I don't know any
> equivalent on Windows XP) and I see that Vim writes the
> file by chunks of 8192 bytes
...snip...
Google search "strace Windows XP" shows something similar
to strace on Windows. You could try to use it to see what
system calls make Notepad and Vim when writing a file on
your shared mapped drive "k:". The difference might be helpful
to explain the speed difference.
Cheers
-- Dominique
Thanks for the detailed report. That rings a bell now. Take a look
at this thread from January:
http://groups.google.com/group/vim_use/browse_thread/thread/ced1795b324d1b4e?pli=1
It looks similar to what you're experiencing.
User reported in above thread said that with 'set noshellslash' then
accessing //computer/c$/test.txt is fast (see :help shellslash)
Can you confirm whether it also helps in your case?
Cheers
PS: (reminder) in this mailing list, the convention is to bottom post
i.e. reply below the original message rather than above it.
-- Dominique
This is probably caused by the code that figures out the full path name
on Unix. This is required to avoid any trouble with symbolic links.
Especially editing the same file under different names.
Your directory is actually on a network share that doesn't support
symbolic links. But that's very difficult to detect.
I'm not sure if there is any way to avoid this without compromising
reliability. Perhaps the expansion can be postponed or done in the
background. That would make it more complex.
I'm experiencing the same problem by editing a file on a network shared
drive with Windows XP. In that case notepad is faster.
Regards,
Cesar