GZip File Reading

dsimcha dsimcha at yahoo.com
Fri Mar 11 06:00:10 PST 2011


On 3/11/2011 8:04 AM, Steven Schveighoffer wrote:
> On Thu, 10 Mar 2011 20:29:55 -0500, Walter Bright
> <newshound2 at digitalmars.com> wrote:
>
>> On 3/10/2011 6:24 AM, dsimcha wrote:
>>> On 3/10/2011 4:59 AM, Walter Bright wrote:
>>>> On 3/9/2011 8:53 PM, dsimcha wrote:
>>>>> I'd like to get some comments on what an appropriate API design and
>>>>> implementation for writing gzipped files would be. Two key
>>>>> requirements are that
>>>>> it must be as easy to use as std.stdio.File and it must be easy to
>>>>> extend to
>>>>> support other single-file compression formats like bz2.
>>>>
>>>> Use ranges.
>>>
>>> Ok, obviously. The point was trying to figure out how to maximize the
>>> reuse of
>>> the infrastructure from std.stdio.File.
>>
>> It's not so obvious based on my reading of the other comments. For
>> example, we should not be inventing a streaming interface.
>
> C's FILE * interface is too limiting/low performing. I'm working to
> create a streaming interface to replace it, and then we can compare the
> differences. I think it's pretty obvious from Tango's I/O performance
> that a D-based stream interface is a better approach.
>
> Ranges should be built on top of that interface.
>
> I won't continue the debate, since it's difficult to argue from a
> position of theory. However, I don't think it will be long before I can
> show some real numbers. I'm not expecting Phobos to adopt, based on my
> experience with dcollections, but it should be seamlessly usable with
> Phobos, especially since range-based functions are templated.
>
> -Steve

Well, I certainly appreciate your efforts.  IMHO the current state of 
file I/O for anything but uncompressed plain text in D is pretty sad. 
Even uncompressed plain text is pretty bad on Windows due to various 
bugs.  IMHO one huge improvement that could be made to Phobos would be 
to create modules for reading the most common file formats (my personal 
list would be gzip, bzip2, png, bmp, jpeg and csv) with a nice 
high-level D interface.


More information about the Digitalmars-d mailing list