On Mon, 2005-07-25 at 16:23 +0000, Mystilleef wrote:
> On 7/25/05, Johan Dahlin <[EMAIL PROTECTED]> wrote:
> > So, if you have a 20M file and you're doing 4k requests,
> > gnome-vfs is going to have a queue of about 5120 read requests, which
> > will end up in 5120 read() calls and 5120 calls to your read_cb.
> > 
> > It'd probably be a lot more efficient to read more than 4K at a time, and
> > not put so high load on the communication between the threads inside
> > gnome-vfs. 
> 
> Maybe, but I let GNOMEVFS determine the most efficient method to
> reading files using its file_info.io_block_size property. I understand
> this may vary for different architectures or filesystems, so I don't
> want to fiddle with that.
> 
> >Are the asynchronous callbacks in gnome-vfs called from
> > the same thread?
> > If read_cb is called from another thread you'll have problems inserting
> > data into the text buffer.
> 
> I believe the asynchronous callbacks are from the same thread.
>  
> > You can also experiment in waiting for the result before sending more read
> > requests, so you keep the queues in gnome-vfs smaller.
> 
> How do I accomplish this?

  In open_cb, schedule a _single_ read of block size; In read_cb, read
what there is to read, then schedule another read using the same
callback, until you've read the entire file.

  PS: the classes VFSAsyncBaseGUI, VFSAsyncLoaderGUI, and
VFSAsyncSaverGUI in [1] may be useful to you.


[1] 
http://cvs.sourceforge.net/viewcvs.py/numexp/gnumexp/src/xygraph/Numexp_XYGraph/persist.py?view=auto

> 
> Thanks
> _______________________________________________
> pygtk mailing list   [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to