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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,68494635acddb77e X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!s50g2000hsb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: File output and buffering Date: Wed, 20 Aug 2008 01:43:52 -0700 (PDT) Organization: http://groups.google.com Message-ID: <4af2f934-7458-4370-b325-c38e3a4068b8@s50g2000hsb.googlegroups.com> References: <60a35fd4-e5a6-4aa0-a73f-6815ce7e92fc@f36g2000hsa.googlegroups.com> NNTP-Posting-Host: 128.141.45.203 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1219221832 32633 127.0.0.1 (20 Aug 2008 08:43:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 20 Aug 2008 08:43:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s50g2000hsb.googlegroups.com; posting-host=128.141.45.203; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7394 Date: 2008-08-20T01:43:52-07:00 List-Id: On 19 Sie, 22:27, Maciej Sobczak wrote: > It seems to me that the file output in standard Ada library is not > buffered: > 1. There is no buffer-related operation in the whole library. > 2. The semantics of output operations is defined in terms of the > effects on external file. > 3. The performance of simple test is consistent with what can be > obtained in equivalent C code that flushes the channel after every > operation (ie. some 15-20x slower than with default buffering). Now I'm puzzled, because it looks like the files are written in chunks of 32kB. In other words, nothing is written to the file until the total output accumulated to 32kB and the step is preserved for each future write - this indicates that the buffering is actually in use. My original observations become questions: 1. Why there is no buffer-related operation in the whole library? In particular: how can I *flush* the buffer? This is very important for log files. I have discovered this exactly because the log is not written synchronously with Put operations, which makes it "a bit" less useful. How can I make sure that what I Put is actually written? Closing a file after each Put does not make much sense. 2. What about the semantics of Put? 3. Why is buffered Ada.Text_IO as slow as non-buffered C's stdio? Who is eating the 20x factor? -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada