On Jan 22, 11:09 pm, Dominique Pellé <[email protected]>
wrote:
>
> I'm curious to see your patch when ready.
>
> Reading by buffer of 200 bytes makes f_readfile() complicated.
> I think we're better off reading byte by byte using fgetc(fd)...

Googling "fgetc performance" indicates that on some platforms at least
that would be a bad idea.  F. ex.

http://groups.google.com/group/perfo/msg/530fae8e5e065030

shows fgetc 200 times slower.  Another said each call to any stdio has
to lock the stream in case of concurrent access to it, making fgetc
slow.  There exist unlocked versions to avoid this, but I doubt vim's
build wants to worry about that.

An odd thing about the present code is the #define:

#define FREAD_SIZE 200      /* optimized for text lines */
    char_u      buf[FREAD_SIZE];

sitting in the declarations for f_readfile, and unused anywhere else.
Looking in vim.h, there's a section "Buffer sizes" with IOSIZE
appearing to be the most applicable.  I was expecting some sort of
feature macro dependent buffer size, so that vim on smaller systems
would have smaller buffers.

Regards, John

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui