[Bioperl-l] flushing i/o with TreeIO

Ewan Birney birney@ebi.ac.uk
Fri, 12 Jul 2002 03:08:22 -0400 (EDT)


On Fri, 12 Jul 2002, Jason Stajich wrote:

> On Thu, 11 Jul 2002, Aaron J Mackey wrote:
>
> >
> > Shouldn't we be flushing our filehandles after we finish with a
> > write_seq??  Is there some reason not to?  It seems like not doing so just
> > leads to this kind of odd, "behind the scenes" behavior ...
> >
> > -Aaron
> >
>
> Problem is that the writer is writing to a stream, we can't close it
> because more might be written (repeated calls to write_seq/write_tree,
> etc).  We can solve this by turning on autoflush, but there might be a
> performance hit with autoflush (I'm guessing there is, that's why it is
> turned off by default?) ?  Something to test and see.
>
> I think that with any sort of filehandle the programmer is going to have
> to take responsibility to call close on the handle when they are done
> writing before reading data back in from the file.  But we should
> include something in documentation for sure.


We could call flush at the end of every sequence write (which is not as
agressive as autoflush) as a flag which you can switch off if you want
better performance.

But basically I agree with Jason - the caller has to be responsible for
closing the stream to guarentee file semantics...



>
> -jason
>
> --
> Jason Stajich
> Duke University
> jason at cgt.mc.duke.edu
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>