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-Thread: a07f3367d7,c19e8df8a75221d0 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 31 Aug 2009 18:52:31 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Q: Line_IO References: <4a9b045a$0$31875$9b4e6d93@newsspool3.arcor-online.net> <7225bda9-8757-4c5c-bb44-b3be21a1e1f9@p36g2000vbn.googlegroups.com> <4a9ba04a$0$32678$9b4e6d93@newsspool2.arcor-online.net> <41445103-0faf-4cb3-be93-99cb1d3c0080@z4g2000prh.googlegroups.com> In-Reply-To: <41445103-0faf-4cb3-be93-99cb1d3c0080@z4g2000prh.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4a9bffcf$0$32667$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 31 Aug 2009 18:52:31 CEST NNTP-Posting-Host: 3eef7e40.newsspool2.arcor-online.net X-Trace: DXC=ZYMFFY=aH<`^Y=RbYBPl4`A9EHlD;3Ycb4Fo<]lROoRa^YC2XCjHcbi@3CKQ\5Q69a;9OJDO8_SKfNSZ1n^B98ijkNQ?MOTi\3c X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8075 Date: 2009-08-31T18:52:31+02:00 List-Id: Anh Vo schrieb: > I am curious how close when compared to GNAT.IO.Put_Line and > GNAT.IO.Get_Line. If it is close enough, I would say it is the best of > both worlds, speed and portability. For reading, I don't know how to compare GNAT.IO.Get_Line. This Get_Line seems to ignore the end of input. AFAICS, it is implemented using C's getchar(), non-macro-versions IIUC. Never compares the result of imported get_char <- getchar() against C's EOF. GNAT.IO.Put_Line seem to be slow. It, too, ends up calling C's putchar(). In fact, it appears to be running many times more slowly than Text_IO.Put_Line. A few statistical results, sampled on one GNU/Linux machine. $ gnatmake -g -O2 -gnatwa -gnatn test_line_io.adb $ ./test_line_io < {250MB text file} > {some output file} With Line_IO.Print and - Line_IO.Getline: ~3 seconds. - Text_IO.Get_Line: ~7.5 seconds. With Ada.Text_IO.Put_Line and - Line_IO.Getline: ~21 seconds - Text_IO.Get_Line: ~27 seconds