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-20 17:42:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: 'Write attribute vs Write procedure. References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1053477753 12.234.13.56 (Wed, 21 May 2003 00:42:33 GMT) NNTP-Posting-Date: Wed, 21 May 2003 00:42:33 GMT Organization: AT&T Broadband Date: Wed, 21 May 2003 00:42:33 GMT Xref: archiver1.google.com comp.lang.ada:37573 Date: 2003-05-21T00:42:33+00:00 List-Id: > 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 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.