comp.lang.ada
 help / color / mirror / Atom feed
From: Jano <nono@celes.unizar.es>
Subject: 'Write attribute vs Write procedure.
Date: Wed, 21 May 2003 02:07:05 +0200
Date: 2003-05-21T02:07:05+02:00	[thread overview]
Message-ID: <MPG.1934e1948ad1faf989709@News.CIS.DFN.DE> (raw)

Hi everybody.

I'm getting abysmal differences in speed when writing large chunks (64k) 
of data to a stream. The stream is from a socket of Gnat.Sockets, I 
mention it because I don't know if it has something to do.

See the two following snippets of code:

----common-----
Buffer : Stream_element_array (1 .. 
            Stream_element_offset (Upload_buffer_size));
----common-----

----case A-----
Write (This.Link.all, 
   Buffer (1 .. Stream_element_offset (Chunk)));
----case A-----

----case B-----
Stream_element_array'Write (This.Link, 
   Buffer (1 .. Stream_element_offset (Chunk)));
----case B-----

In the above example (without optimizations and -O2 tried, both the 
same), 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 
usage, shared more or less equally by my program and the SYSTEM process, 
whatever it is, on WinXP. Compiler is Gnat 3.15p, computer Pentium III 
450Mhz.

I'm asking only out of curiosity, and to prevent any other surprise in 
the future. Could it be related to alignment checks/adjustments?

P.s: The 'Read attribute is also fast, no noticeable delay.

P.s2: I've tried also with strings, only the 'Write version of course, 
and results are the same.

-- 
-------------------------
Jano
402450.at.cepsz.unizar.es
-------------------------



             reply	other threads:[~2003-05-21  0:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-21  0:07 Jano [this message]
2003-05-21  0:42 ` 'Write attribute vs Write procedure 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
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