GZip File Reading

Steven Schveighoffer schveiguy at yahoo.com
Mon Mar 14 11:07:15 PDT 2011


On Mon, 14 Mar 2011 09:17:04 -0400, dsimcha <dsimcha at yahoo.com> wrote:

> On 3/14/2011 8:22 AM, Steven Schveighoffer wrote:
>> BTW, that crufty old stuff
>> probably way outperforms anything you could ever do with ranges as the
>> base.
>
> I don't get the concern about performance, for file I/O at least.  Isn't  
> the main bottleneck reading it off the disk platter?

That is solved by buffering, which would be done in either case.

With ranges, you likely have to copy things more than if you use a proper
stream interface, or else make the interface very awkward.  I don't know
about you, but having to set the amount I want to read before I call front
seems awkward.  The library I'm writing optimizes the copying so there is
very little copying from the buffer.

If you look at Tango's I/O performance, it outperforms even C I/O, and
uses a class/interface hierarchy w/ delegates for reading data.

I think the range concept is good to paste on top of a buffered I/O
stream, but not to use as the base.  For example, byLine is a good example
of an I/O range that would use a buffered I/O stream to do its work.

See this message I posted a few months back:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=119400

A couple replies later I outline how to do byLine funtion (and easily a  
range) on top of such a
stream.

This is the basis for my current I/O library I'm writing.

-Steve


More information about the Digitalmars-d mailing list