comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Performance of the Streams 'Read and 'Write
Date: Fri, 30 Oct 2009 12:12:18 -0700
Date: 2009-10-30T12:12:18-07:00	[thread overview]
Message-ID: <hcfdpo$p62$1@news.tornevall.net> (raw)
In-Reply-To: <0554a812-076a-4d89-8ec4-fcbc27e25804@v30g2000yqm.googlegroups.com>

Gautier write-only wrote:
> On 30 Okt., 01:39, "Jeffrey R. Carter"
> <spam.jrcarter....@spam.acm.org> 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



  reply	other threads:[~2009-10-30 19:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 23:29 Performance of the Streams 'Read and 'Write Gautier write-only
2009-10-30  0:39 ` Jeffrey R. Carter
2009-10-30  8:58   ` Gautier write-only
2009-10-30 19:12     ` Jeffrey R. Carter [this message]
2009-10-31 23:46       ` Gautier write-only
2009-11-01 21:38       ` Gautier write-only
2009-11-02 21:32       ` Randy Brukardt
2009-10-30  3:36 ` Georg Bauhaus
2009-10-30  9:13   ` Gautier write-only
2009-11-02 21:37     ` Randy Brukardt
2009-11-02 22:16       ` Gautier write-only
2009-10-30 13:40 ` Gautier write-only
2009-11-02 22:19   ` Gautier write-only
2009-11-17 12:57 ` Gautier write-only
2009-11-17 13:26   ` Ludovic Brenta
2009-11-17 20:19   ` Building GNAT on Windows (Was: Re: Performance of the Streams 'Read and 'Write) Tero Koskinen
2009-11-18 10:55     ` Gautier write-only
2009-11-26 13:23   ` Performance of the Streams 'Read and 'Write Gautier write-only
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox