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 Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!news.tornevall.net!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Performance of the Streams 'Read and 'Write Date: Fri, 30 Oct 2009 12:12:18 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <0554a812-076a-4d89-8ec4-fcbc27e25804@v30g2000yqm.googlegroups.com> NNTP-Posting-Host: e7236ad8a40d01cfdc28072de828f0f8 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 4f67a0b2046bdc9f7ba0b58360244483 X-Complaints-To: abuse@tornevall.net X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: <0554a812-076a-4d89-8ec4-fcbc27e25804@v30g2000yqm.googlegroups.com> X-Validate-Post: http://news.tornevall.net/validate.php?trace=4f67a0b2046bdc9f7ba0b58360244483 X-SpeedUI: 1738 X-Complaints-Italiano: Parlo la lingua non � italiano User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) X-Posting-User: 9b22bfe2855937f9b3faeec7cfc91295 Xref: g2news2.google.com comp.lang.ada:8899 Date: 2009-10-30T12:12:18-07:00 List-Id: Gautier write-only wrote: > On 30 Okt., 01:39, "Jeffrey R. Carter" > wrote: > >> And if you overlay the Stream_Element_Array onto the Buffer, thus eliminating >> the copying and the stream attribute operations? > > With an Unchecked_conversion ? No, that still does a copy. Type Buffer, as a simple array of bytes, should have Buffer'Component_Size = Unsigned_8'Size by default; but you can specify it if you're paranoid. If you're really paranoid, you can add a test that Unsigned_8'Size = Stream_Element'Size, which you seem to be assuming. Then procedure Put (B : in Buffer) is -- Terrible naming scheme. subtype Buffer_Stream is Stream_Element_Array (1 .. B'Length); S : Buffer_Stream; for S'Address use B'Address; pragma Import (Ada, S); begin -- Put Write (S); end Put; -- Jeff Carter "I spun around, and there I was, face to face with a six-year-old kid. Well, I just threw my guns down and walked away. Little bastard shot me in the ass." Blazing Saddles 40