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,f6f130eea077b8f8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-21 00:49:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!news.compaq.com!nntp-relay.ihug.net!ihug.co.nz!news-out.nuthinbutnews.com!propagator2-sterling!in.nntp.be!dax.net!juliett.dax.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: 'Write attribute vs Write procedure. References: From: Ole-Hjalmar Kristensen Message-ID: <7vof1w7naf.fsf@vlinux.voxelvision.no> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 May 2003 07:48:41 GMT NNTP-Posting-Host: 193.216.12.150 X-Complaints-To: abuse@tele2.no X-Trace: juliett.dax.net 1053503321 193.216.12.150 (Wed, 21 May 2003 09:48:41 MET DST) NNTP-Posting-Date: Wed, 21 May 2003 09:48:41 MET DST Organization: Tele2 Norway AS Public Access Xref: archiver1.google.com comp.lang.ada:37578 Date: 2003-05-21T07:48:41+00:00 List-Id: tmoran@acm.org writes: > > Write (This.Link.all, > > Buffer (1 .. Stream_element_offset (Chunk))); > > Stream_element_array'Write (This.Link, > > Buffer (1 .. Stream_element_offset (Chunk))); > >... > > the Write procedure is taking no noticeable amount of time/cpu. > >In the contrary, the 'Write attribute takes like 3-4 seconds of 100% CPU > Perhaps Gnat's 'Write is doing one 'Write(Stream_Element) call for > each element of the Buffer, vs a single call for the whole thing in > the procedure version? Since you've already got a Stream_Element_Array, > perhaps you could call You hit the nail on the head. > Ada.Streams.Write(Ada.Streams.Root_Stream_Type'class(This.Link), > Buffer (1 .. Stream_element_offset (Chunk))); > directly? > Personally, I think using the default 'write is only reasonable > in the very simplest cases. If something is big, or complicated, > I'd write my own 'write for it. -- Ole-Hj. Kristensen ****************************************************************************** * You cannot consistently believe this sentence. ******************************************************************************