comp.lang.ada
 help / color / mirror / Atom feed
From: Craig Carey <research@ijs.co.nz>
Subject: Re: 'Write attribute vs Write procedure.
Date: Fri, 23 May 2003 18:09:25 +1200
Date: 2003-05-23T18:09:25+12:00	[thread overview]
Message-ID: <prarcv0cidajjkv1t1favsv4ch0qglht1s@4ax.com> (raw)
In-Reply-To: ZXzya.660213$OV.619773@rwcrnsc54

On Wed, 21 May 2003 00:42:33 GMT, tmoran@acm.org wrote:

>> 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.  [...]


X'Write() would have to come out best in a comparison involving at least
two choices. Some other principle, presumably something 'unreasonable',
shows up when there is not much Ada 95 code.


--

PS. GNAT is allocating tracking numbers for requests on GNAT.Sockets,
including for requests for big rewrites. ACT might not be planning on
rewriting the package (I don't know). I got this subject header back:

"[C516-004 public] Programming style of exception raising in GNAT.Sockets,
   etc."

So similarly, GNAT.Sockets could be altered so that the comments in it
suggesting use of Ada 95's X'Read feature, are deleted or discouraged.

X'Read() has no parameter for diagnostics on what the malfunction was.
The language can be revised so that X'Read is deleted or else it returns
error information out directly so that it is available to very next
line in the source code. If Ada becomes a language where malfunctioning
programs don't know why, and are really cryptic in describing the
precise problem (e.g. since code in exception handlers tries to handle too
many errors), then it could be all made reasonable (insufficiently
reasonable) by the new style of new unneeded code that seems to do
ntohing to a single byte but just lose the error info so that the next
line can't get it (it has to be the line after if the code is in an
exception handler).

However ACT is saying that customers do not seek big changes in
GNAT.Sockets.


Craig Carey
http://www.ijs.co.nz/ada_95.htm <- mailing lists




  parent reply	other threads:[~2003-05-23  6:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-21  0:07 'Write attribute vs Write procedure Jano
2003-05-21  0:42 ` tmoran
2003-05-21  7:48   ` Ole-Hjalmar Kristensen
2003-05-21  9:23   ` Ole-Hjalmar Kristensen
2003-05-21 16:22     ` tmoran
2003-05-22  7:51       ` Ole-Hjalmar Kristensen
2003-05-21 16:24     ` tmoran
2003-05-21 21:17     ` Simon Wright
2003-05-22  8:02       ` Ole-Hjalmar Kristensen
2003-05-22 13:49       ` Marc A. Criley
2003-05-22 20:07         ` Simon Wright
2003-05-23  6:09   ` Craig Carey [this message]
2003-05-23 19:55     ` Simon Wright
2003-05-23 20:48       ` AI-248 and counting the elements in an external file Larry Kilgallen
2003-05-23 21:12         ` Stephen Leake
2003-05-23 21:45           ` Randy Brukardt
2003-05-24  1:45             ` Larry Kilgallen
2003-05-24 22:00               ` Robert I. Eachus
2003-05-25  3:54                 ` Larry Kilgallen
2003-05-27 20:19                   ` Randy Brukardt
2003-05-27 20:57                     ` Larry Kilgallen
2003-05-28 18:26                       ` Randy Brukardt
2003-05-24  1:42           ` Larry Kilgallen
2003-05-28 21:17             ` Brian Gaffney
2003-05-28 22:06               ` Larry Kilgallen
2003-05-24 14:11 ` 'Write attribute vs Write procedure Craig Carey
replies disabled

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