Re: Writev

2004-12-21 Thread Adam DePrince
On Sun, 2004-12-19 at 23:43, Jp Calderone wrote: > On Sun, 19 Dec 2004 23:12:27 -0500, Adam DePrince <[EMAIL PROTECTED]> wrote: > > [snip] > > > > Of course, to take advantage of this requires that writev be exposed. I > > have an implementation of writev.

Re: Writev

2004-12-20 Thread Mike Meyer
Adam DePrince <[EMAIL PROTECTED]> writes: > I want to include it because POSIX has a single OS call that > conceptually maps pretty closely to writelines. I just want to point out that on some systems, POSIX is a compatability layer, not an OS layer. On those systems, the implement

Re: Writev

2004-12-20 Thread Steven Bethard
Adam DePrince wrote: [snip great explanation] I want to include it because POSIX has a single OS call that conceptually maps pretty closely to writelines. writev can be faster because you don't have to do memory copies to buffer data in one place for it -- the OS will do that, and can some

Re: Writev

2004-12-20 Thread Adam DePrince
it looks like file.writelines makes a call > to 'fwrite' for each item in the iterable given. Your code, if I read > it right, makes a call to 'writev' for each item in the iterable. No, my code makes a call to writev for every nth iterable, where n is usually 1024.

Re: Writev

2004-12-19 Thread Steven Bethard
if I read it right, makes a call to 'writev' for each item in the iterable. I looked at the fwrite() and writev() docs and read your comments, but I still couldn't quite figure out what makes 'writev' more efficient than 'fwrite' for the same size buffer... Mi

Re: Writev

2004-12-19 Thread Adam DePrince
map(file.write, mydata) > > which I would write as: > > file.writelines(mydata) > > Could you explain a little more what your intent is here? file.writelines( seq ) and map( file.write, seq ) are the same; the former is syntactic sugar for the later. Writev is a neat

Re: Writev

2004-12-19 Thread Adam DePrince
On Sun, 2004-12-19 at 23:43, Jp Calderone wrote: > On Sun, 19 Dec 2004 23:12:27 -0500, Adam DePrince <[EMAIL PROTECTED]> wrote: > > [snip] [snip] to free the memory, of course. > > The support of iterators is a cool idea, but I'm not sure > it is actually useful. Consider the case where not

Re: Writev

2004-12-19 Thread Steven Bethard
Adam DePrince wrote: Many other programmers have faced a similar issue; cStringIO, ''.join([mydata]), map( file.write, [mydata]) are but some attempts at making this process more efficient by jamming the components to be written into a sequence. I'm obviously misunderstanding something because I ca

Re: Writev

2004-12-19 Thread Jp Calderone
On Sun, 19 Dec 2004 23:12:27 -0500, Adam DePrince <[EMAIL PROTECTED]> wrote: > [snip] > > Of course, to take advantage of this requires that writev be exposed. I > have an implementation of writev. This implementation is reasonably > smart, it "unrolls" only so

Writev

2004-12-19 Thread Adam DePrince
d be a substantial benefit. Perusing through the posix module reveals that the posix writev call is not exposed. Writev is the POSIX answer to this problem for very similar reasons. The ability to expose a list of strings to be outputted to the hardware level would allow for the exploita