Re: A performance question (patch included)

2007-05-25 Thread John Beckett
Charles E Campbell Jr wrote: I've attached a patch to vim 7.1 which extends getfsize(); with the patch, getfsize() takes an optional second parameter which gives one the ability to specify a "unitsize". Things move quickly here ... I'm still polishing my code. However, I don't think it's going

Re: A performance question (patch included)

2007-05-25 Thread John Beckett
Charles E Campbell Jr wrote: I'm also under the impression that "ls" itself uses fstat(), so its not likely to be any more informative. That's likely on some systems, but 'ls -l' gives correct results for files over 4GB on Fedora Core 6 using x86-32. John

Re: A performance question (utility included)

2007-05-25 Thread John Beckett
Charles E Campbell Jr wrote: I've attached a patch to vim 7.1 which extends getfsize() As I've mentioned, I think further testing will be needed before patching Vim for 64-bit file lengths. Here is a possible interim workaround to allow Dr.Chip's LargeFile.vim script to accurately detect large

Re: A performance question (patch included)

2007-05-25 Thread A.J.Mechelynck
Yakov Lerner wrote: [...] stat() on Linux has 32-bit st_size field (off_t is 32-bit). There is stat64() syscall which uses 'struct stat64' structure where st_size is 64-bit. By defining __USE_LARGEFILE64 at compile-time, stat() is redirected to stat64(). I don't know whether default Linux vim bu

Re: A performance question (patch included)

2007-05-25 Thread Yakov Lerner
On 5/25/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: Charles E Campbell Jr wrote: > A.J.Mechelynck wrote: > >> I'm not sure what varnumber_T means: will st.stsize (the dividend) be >> wide enough to avoid losing bits on the left? > > varnumber_T is int (long if an sizeof(int) <= 3). > > st.stsiz

Re: A performance question (patch included)

2007-05-25 Thread Charles E Campbell Jr
A.J.Mechelynck wrote: Yes, yes, but before the division, will it be able to hold the file size? (sorry, I meant st.st_size) Will mch_stat (at line 10134, one line before the context of your patch) be able to return "huge" file sizes? mch_stat is variously defined, depending on o/s. Under uni

Re: A performance question (patch included)

2007-05-25 Thread A.J.Mechelynck
Charles E Campbell Jr wrote: A.J.Mechelynck wrote: I'm not sure what varnumber_T means: will st.stsize (the dividend) be wide enough to avoid losing bits on the left? varnumber_T is int (long if an sizeof(int) <= 3). st.stsize 's size depends on whether 32bit or 64bit integers are available.

Re: A performance question (patch included)

2007-05-25 Thread Charles E Campbell Jr
A.J.Mechelynck wrote: I'm not sure what varnumber_T means: will st.stsize (the dividend) be wide enough to avoid losing bits on the left? varnumber_T is int (long if an sizeof(int) <= 3). st.stsize 's size depends on whether 32bit or 64bit integers are available. So, its possible to lose bit

Re: A performance question (patch included)

2007-05-25 Thread Charles E Campbell Jr
Nikolai Weibull wrote: On 5/25/07, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote: getfsize("eval.c") -> 478347 (after the patch) getfsize("eval.c",1000) -> 479 (truncated upwards) Why can't this be done in VimScript? Consider a 3GB file; getfsize("ThreeGBfile") will return

Re: A performance question (patch included)

2007-05-25 Thread A.J.Mechelynck
Charles E Campbell Jr wrote: John Beckett wrote: A.J.Mechelynck wrote: What about a different function to return, say, the number of 1K blocks (or the number of times 2^n bytes, with a parameter passed to the function) that a file uses? Yes, that's a much more general and better idea. Sin

Re: A performance question (patch included)

2007-05-25 Thread Nikolai Weibull
On 5/25/07, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote: getfsize("eval.c") -> 478347 (after the patch) getfsize("eval.c",1000) -> 479 (truncated upwards) Why can't this be done in VimScript? nikolai

Re: A performance question (patch included)

2007-05-25 Thread Charles E Campbell Jr
John Beckett wrote: A.J.Mechelynck wrote: What about a different function to return, say, the number of 1K blocks (or the number of times 2^n bytes, with a parameter passed to the function) that a file uses? Yes, that's a much more general and better idea. Since there's probably not much n