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-13 08:46:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!feed.cgocable.net!read2.cgocable.net.POSTED!53ab2750!not-for-mail Message-ID: <3D820853.4040503@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Thoughts on the recent ICFP contest References: <3D80C1B1.5070703@telepath.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 13 Sep 2002 11:46:27 -0400 NNTP-Posting-Host: 24.150.168.167 X-Complaints-To: abuse@cogeco.ca X-Trace: read2.cgocable.net 1031932047 24.150.168.167 (Fri, 13 Sep 2002 11:47:27 EDT) NNTP-Posting-Date: Fri, 13 Sep 2002 11:47:27 EDT Organization: Cogeco Cable Xref: archiver1.google.com comp.lang.ada:28938 Date: 2002-09-13T11:46:27-04:00 List-Id: tmoran@acm.org wrote: ... >>that 'Write on a 1000-byte array will, by default, perform one 'Write on >>each component of that array, amounting to 1000 'Writes. That means >>any time someone is interested in efficency, they end up having to make >>their own 'Write that calls Ada.Streams.Write once for each object that >>they want transferred efficiently. This is an issue for *any* stream, >>not just the one I'm proposing above. > > Agreed. Anytime you make a data structure that needs to be read/written, > part of the job is to write the Data_Structure'Write etc. routines. So > it would be nice to have an efficient String'Write, but I'm not sure how > much real work it would let you avoid. I encountered this type of performance problem with my APQ Ada95 interface to PostgreSQL. I provide a streams interface to blobs. However, when I tried to write strings to the blob, the performance was abysmal because each byte was being sent to the database server and acknowledged back up the food chain. I solved the problem (mostly) by providing buffered reads and writes to the blob, much the same way the fread(2) and fwrite(2) calls in C work. It turned out to be simpler than expected, because you can do all of the buffering work at the bottom stream layer. See the following link if you have the patience to sift through the code: http://home.cogeco.ca/~ve3wwg/apq-1.9.tar.gz I have been tempted to look at that very same issue for sockets myself. I have also pondered whether there is a universal way (non-GNAT specific) using XDR routines to make the I/O endian neutral. I know that GNAT uses some vector of routines technique to do this, though I've not fully explored this yet. Do a google search -- it was discussed this year I think. -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg