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-12 09:43:58 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!enews.sgi.com!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.news2me.com!west.cox.net!cox.net!p01!news2.central.cox.net.POSTED!53ab2750!not-for-mail Message-ID: <3D80C452.90608@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> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 12 Sep 2002 16:43:50 GMT NNTP-Posting-Host: 68.12.51.201 X-Complaints-To: abuse@cox.net X-Trace: news2.central.cox.net 1031849030 68.12.51.201 (Thu, 12 Sep 2002 12:43:50 EDT) NNTP-Posting-Date: Thu, 12 Sep 2002 12:43:50 EDT Organization: Cox Communications Xref: archiver1.google.com comp.lang.ada:28874 Date: 2002-09-12T16:43:50+00:00 List-Id: Wes Groleau wrote: > >>>to transmit an entire buffer at once, rather than one component at a >> >> Like marshalling all those 'Writes to a buffer, then making one >>socket'write(buffer) call? > > > Have I missed the point all this time? > I thought that 'Write recursively used > all the component 'Writes to pack the > object into a stream, and then the > possibly dispatching operations of the > stream would determine the method of > transmission. As a point of reference, perhaps you should see this post: http://groups.google.com/groups?q=streams+stream_io+group:comp.lang.ada+author:dennison%40telepath.com&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=94hjbp%24ks6%241%40nnrp1.deja.com&rnum=4 from a couple of years ago. The issue is that each 'Write on a "leaf object" (a non-compound object) will result in its own call to the stream's Write routine. That means if I do a 'Write on a 1K string, the stream's Write routine gets called 1024 times. That's a lot of overhead, not to mention that many stream objects might be way more efficient with one Write of 1K than they are with 1024 one-byte writes. That is certianly the case with Gnat's Ada.Streams.Stream_IO This issue has come up here many times before. The answer is always that the user should either call the stream's Write routine themselves directly with the entire buffer, or overload their object's 'Write attribute with their own routine that does that. I'm thinking it would be nice to have an object that does this for you, rather than everyone always having to go out and write this same code.