From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,68b43b837fb71f2a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-16 20:21:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!cox.net!p01!news2.central.cox.net.POSTED!53ab2750!not-for-mail Message-ID: <3D869FA9.6010203@telepath.com> From: Ted Dennison User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Thoughts on the recent ICFP contest References: <3D7FFD66.9030805@telepath.com> <3D80A356.93042472@despammed.com> <3D8641FE.927D0D7A@despammed.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 17 Sep 2002 03:21:14 GMT NNTP-Posting-Host: 68.12.51.201 X-Complaints-To: abuse@cox.net X-Trace: news2.central.cox.net 1032232874 68.12.51.201 (Mon, 16 Sep 2002 23:21:14 EDT) NNTP-Posting-Date: Mon, 16 Sep 2002 23:21:14 EDT Organization: Cox Communications Xref: archiver1.google.com comp.lang.ada:29059 Date: 2002-09-17T03:21:14+00:00 List-Id: 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.