comp.lang.ada
 help / color / mirror / Atom feed
From: "M. Kotiaho" <mylastname@mail.com>
Subject: Re: Optimization Question
Date: Mon, 22 Jan 2001 13:04:18 -0600
Date: 2001-01-22T13:04:18-06:00	[thread overview]
Message-ID: <3A6C8432.665A730C@mail.com> (raw)
In-Reply-To: 94g920$k64$1@nnrp1.deja.com

dvdeug@my-deja.com wrote:

> In article <94g431$ge3$1@nnrp1.deja.com>,
>   Robert Dewar <robert_dewar@my-deja.com> wrote:
> > In article <94ftfu$b59$1@nnrp1.deja.com>,
> >   dvdeug@my-deja.com wrote:
> >
> > <<questions about speeding up code snipped>>
> >
> > I am *amazed* that this is only ten times slower when the
> > I/O is done in such a perfectly gruesome manner (sequential
> > I/O instantiated on bytes).
> >
> > It is elementary that you want to read big chunks of a file
> > at a time. What GNAT does is to read the entire source of
> > a program in one read statement.
>
> Actually, it's only about 3-5 times slower, after doing more careful
> measurements. I think GNU strings might be too wrapped up in the details
> of object code to be a good general purpose strings program.
>
> Unfortunately, that "perfectly gruesome manner" is the only one that
> jumps out at me. I don't want to use Ada.Text_IO, because I want control
> of CR's and LF's. I don't see how to use Sequential I/O on larger
> chunks, as I may end up with a piece of file that doesn't fill a chunk.
> Direct I/O can't be faster than sequential I/O. And reading a 17GB file
> into memory doesn't seem like a good idea.
>
> --
> David Starner - dstarner98@aasaa.ofe.org
>
> Sent via Deja.com
> http://www.deja.com/

As has been pointed out elsewhere, you can use Streams to read "big chunks"
at a time.  As you pointed out, you don't want to read 17 GB into memory.
You can still speed things up by using, say, 10K chunks ... the Read
procedure
has a "Last" parameter that will tell you if you ran out of file before you
filled your
chunk.  You also might want to buffer your output, rather than outputting
the
strings as soon as they are located.

HTH,

M. Kotiaho





  parent reply	other threads:[~2001-01-22 19:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-22  0:05 Optimization Question dvdeug
2001-01-22  1:57 ` Robert Dewar
2001-01-22  3:22   ` dvdeug
2001-01-22  4:05     ` Robert Dewar
2001-01-22  4:06     ` Robert Dewar
2001-01-22 19:04     ` M. Kotiaho [this message]
2001-01-22 20:22       ` dvdeug
2001-01-22 15:24   ` Ted Dennison
2001-01-22 16:12     ` Robert Dewar
2001-01-22 16:48       ` Ted Dennison
2001-01-22 16:15     ` Robert Dewar
2001-01-22 15:26   ` Ted Dennison
2001-01-22 16:17     ` Robert Dewar
2001-01-22 16:59       ` Ted Dennison
2001-01-22 22:01 ` Keith Thompson
2001-01-22 22:52   ` dvdeug
2001-01-23  6:46     ` Keith Thompson
     [not found] ` <94ld65$1hs$1@nnrp1.deja.com>
     [not found]   ` <864ryodb1q.fsf@acm.org>
     [not found]     ` <3A6F663E.C84B94D8@acm.org>
2001-01-26 16:30       ` Optimization Question -- Follow up on using the stream read (and write) procedures directly Jeff Creem
2001-01-26 21:46         ` Florian Weimer
2001-01-27 19:14           ` Jeff Creem
2001-01-28  0:26             ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox