[mercury-users] a question on efficient parsing of a file
Mark Brown
mark at csse.unimelb.edu.au
Tue May 18 22:40:42 AEST 2010
On 18-May-2010, Vladimir Gubarkov <xonixx at gmail.com> wrote:
> On Tue, May 18, 2010 at 4:52 AM, Peter Wang <novalazy at gmail.com> wrote:
>
> > On 2010-05-17, Vladimir Gubarkov <xonixx at gmail.com> wrote:
> > >
> > > But! It seems that io library provides no support for buffered reading
> > Oo.
> > > And without that, I guess, it'll be rather slow (reading 1 char at a
> > time).
> > > Interesting, that I've looked inside the source of io module and it
> > > internally uses buffered reading, but predicates not exported to
> > interface
> > > of those.
> >
> > io.read_char calls getc() eventually, which is buffered by the C
> > library.
> >
>
> I believe you are right. But I'd like to have an ability to set the size of
> a buffer.
>
>
> > I suppose you mean we have no predicate to read up to 'n'
> > bytes/characters at a time. We should probably add one.
> >
> >
> Yes.. Those will be helpful
You can create a bitmap of the desired size then use io.read_bitmap to
read it in. The bitmap can be accessed a byte at a time.
I think we should still provide something to read an array of characters,
though.
Cheers,
Mark.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list