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.8 required=5.0 tests=BAYES_00,URI_HEX autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f6f130eea077b8f8,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-20 17:07:30 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!72105-cm.able.ES!not-for-mail From: Jano Newsgroups: comp.lang.ada Subject: 'Write attribute vs Write procedure. Date: Wed, 21 May 2003 02:07:05 +0200 Message-ID: NNTP-Posting-Host: 72105-cm.able.es (212.97.172.105) X-Trace: fu-berlin.de 1053475649 30144800 212.97.172.105 (16 [49872]) X-Newsreader: MicroPlanet Gravity v2.50 Xref: archiver1.google.com comp.lang.ada:37572 Date: 2003-05-21T02:07:05+02:00 List-Id: 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 -------------------------