comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Thoughts on the recent ICFP contest
Date: Tue, 17 Sep 2002 03:21:14 GMT
Date: 2002-09-17T03:21:14+00:00	[thread overview]
Message-ID: <3D869FA9.6010203@telepath.com> (raw)
In-Reply-To: 3D8641FE.927D0D7A@despammed.com

Wes Groleau wrote:
> What I meant was, I _thought_ that 'Write would put more
> stuff in the stream, and that _another_ call would send
> the assembled stuff to where-ever.

Nope. However, some folk have mentioned making an intermediate stream 
that performs this function (presumably triggered by some kind of 
"flush" call). I have to say, I didn't think of that. I should be 
ashamed of myself, an educated computer scientist, not thinking of 
applying Wheeler's Maxim ("Any problem in computer science can be solved 
with another layer of indirection.")  :-)

However, if you are doing something byte-oriented on a big buffer, the 
'Write calls on each byte alone may chew up a huge amount of time. This 
was touched on in the thread I linked to about disk I/O using 
Ada.Streams.Stream_IO. The underlying transmission mechanisim does 
buffering (as per Robert Dewar), so each 'Write does not actually 
perform an I/O. But still, 'Writing each and every byte took 10 times 
longer than Ada.Streams.Writing the whole buffer when I measured it. 
You'd expect I/O times to dominate over procedure call overhead, even 
for a single I/O, but it doesn't appear to be doing so. (I'm still a 
little doubtful about this, but one has to trust Robert Dewar's word 
about the Gnat internals. :-) )

So what I was talking about doing was creating an object that has a 
'Write and 'Read that are defined to make only one call to 
Ada.Streams.Write and .Read respectively, and that any object can be 
converted into without processing the source object. Any transformation 
done by a 'Write of a lower-level object in an aggregate would not 
happen, but it would be fast for very large aggregates (eg: arrays). You 
can think of it sort of as the System.Address type for streams.

> Obviously, I haven't actually coded any stream stuff.

I found quite a few suprising (to me) things when I first began serious 
stream use. I think its one of those things you really have to do 
yourself once to fully grok.






  reply	other threads:[~2002-09-17  3:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-12  2:35 Thoughts on the recent ICFP contest Ted Dennison
2002-09-12  3:11 ` tmoran
2002-09-12 14:23   ` Wes Groleau
2002-09-12 16:43     ` Ted Dennison
2002-09-12 16:53     ` David C. Hoos
2002-09-16 20:41       ` Wes Groleau
2002-09-17  3:21         ` Ted Dennison [this message]
2002-09-12 19:15     ` tmoran
2002-09-12 16:32   ` Ted Dennison
2002-09-12 19:15     ` tmoran
2002-09-13  1:45       ` Ted Dennison
2002-09-13 15:46       ` Warren W. Gay VE3WWG
2002-09-17 10:36 ` Jacob Sparre Andersen
2002-09-17 12:55   ` Ted Dennison
2002-09-17 14:41     ` Jacob Sparre Andersen
2002-09-17 10:56 ` Preben Randhol
2002-09-17 12:38   ` Ted Dennison
2002-09-18  0:31     ` tmoran
2002-09-18  7:15     ` Samuel Tardieu
replies disabled

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