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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d4226ffde2290b0c X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!p35g2000yqh.googlegroups.com!not-for-mail From: Gautier write-only Newsgroups: comp.lang.ada Subject: Re: Performance of the Streams 'Read and 'Write Date: Fri, 30 Oct 2009 02:13:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: <715d78f4-9b01-4598-88c1-6fc202983bae@p35g2000yqh.googlegroups.com> References: <4aea5f3b$0$6593$9b4e6d93@newsspool3.arcor-online.net> NNTP-Posting-Host: 206.122.158.4 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1256893999 5270 127.0.0.1 (30 Oct 2009 09:13:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 30 Oct 2009 09:13:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p35g2000yqh.googlegroups.com; posting-host=206.122.158.4; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.27 Safari/532.0,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8882 Date: 2009-10-30T02:13:19-07:00 List-Id: On 30 Okt., 04:36, Georg Bauhaus : > I finally thought that the above procedures are faster than 'Read > or 'Write because the latter are defined in terms of stream elements: > When there is a composite object like b : Buffer and you > 'Write it, then for each component of b the corresponding 'Write > is called. This then writes stream elements, probably > calling Stream_IO.Write or some such in the end. > So Write from above appears closer to writing bulk loads > of stream elements than a bulk load of 'Writes can be. Sure, it is the safe way: write records field by field, arrays element by element (that recursively). The compiler avoids problems with non- packed data. Nothing against that. The general case is well done, fine. But the compiler could have a look a the type left to the attribute and in such a case (an array of Unsigned_8, or a String) say: "Gee! that type Buffer is coincidentally the same as Stream_Element_Array, then I take the shortcut to generate the code to write the whole buffer and, this time, not the code to write it element by element". > Copying buffers does not matter in comparison to the needs of I/O (on PCs). Right. Variant 2 works fine, but it is an heavy workaround in terms of source code. Especially for mixed type I/O with plenty of String'Write and others, you would not want to put the kind of Variant 2 code all over the place. It would be a lot better that compilers are able to take selectively the shortcut form for the attributes. Gautier