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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Q: Line_IO Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4a9b045a$0$31875$9b4e6d93@newsspool3.arcor-online.net> Date: Mon, 31 Aug 2009 20:39:45 +0200 Message-ID: <1a4usf20z4mxa.1vct95fmrcs6h.dlg@40tude.net> NNTP-Posting-Date: 31 Aug 2009 20:39:39 CEST NNTP-Posting-Host: f7ccb91a.newsspool1.arcor-online.net X-Trace: DXC=09A>9R49f@j<6cDJZfMd_cic==]BZ:afn4Fo<]lROoRa^YC2XCjHcbiCfe5QI_]=OiDNcfSJ;bb[eIRnRBaCd On Mon, 31 Aug 2009 00:59:38 +0200, Georg Bauhaus wrote: > Text_IO seems fairly slow when just reading lines of text. > Here are two alternative I/O subprograms for Line I/O, in plain Ada, > based on Stream_IO. They seem to run significantly faster. When you print you do: Stream_IO.Write (Stdout, To_Bytes (Item & Separator_Sequence)); You could try not to concatenate: Stream_IO.Write (Stdout, To_Bytes (Item)); Stream_IO.Write (Stdout, To_Bytes (Separator_Sequence)); , which should be faster when Item is large. Then there is a crazy way to convert congruent types without Unchecked_Conversion. I cannot tell whether it is actually faster: procedure Print (Item : String) is subtype Index is Stream_Element_Offset range 1..Item'Length; subtype XBytes is Stream_Element_Array (Index); Alias : XBytes; for Alias'Address use Item'Address; begin Stream_IO.Write (Stdout, Alias); ... P.S. The superimposed object shall not have initializers. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de