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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,718bd701b6b36346,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-12 08:09:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!193.174.75.178!news-fra1.dfn.de!news.man.poznan.pl!pwr.wroc.pl!panorama.wcss.wroc.pl!hebisch From: hebisch@math.uni.wroc.pl (Waldek Hebisch) Newsgroups: comp.lang.ada Subject: Re: GNAT/Ada95 Streams Performance Issue Date: 12 Aug 2002 15:09:49 GMT Organization: Politechnika Wroclawska Message-ID: References: <3D51ECC9.8020406@cogeco.ca> NNTP-Posting-Host: hera.math.uni.wroc.pl X-Trace: panorama.wcss.wroc.pl 1029164989 11991 156.17.86.1 (12 Aug 2002 15:09:49 GMT) X-Complaints-To: abuse@news.pwr.wroc.pl NNTP-Posting-Date: 12 Aug 2002 15:09:49 GMT X-Newsreader: TIN [version 1.2 PL2] Xref: archiver1.google.com comp.lang.ada:27954 Date: 2002-08-12T15:09:49+00:00 List-Id: Warren W. Gay VE3WWG (ve3wwg@cogeco.ca) wrote: : 3. The individual characters that make up Msg are written : out to stream S, using individual calls to Character'Write. : Step # 3 is the performance killer. : To help in this regard, APQ 1.2 (not released yet) now supports : two new functions for performance reasons: : String_Output to substitute for String'Output : String_Input to substitute for String'Input : These routines deal with the array of characters as : one block of data. : But this is really just a patch over part of a much : larger problem. : How have other people dealt with this type of streams : performance issue? Or do people generally avoid : streams when performance is important? Well, I just toyed with a simple cat program: loop Ada.Text_IO.Get_Line( Line, Last ); Ada.Text_IO.Put_Line( Line(1..Last) ); end loop; Using GNAT (gcc 3.1.1), I get very bad performance (about 10 MB/s, raw system calls (in C) give 450MB/s). I looked at the sources, and while Put_Line essentialy outputs the block (it makes a copy and modifies it slightly) Get_Line works with single characters. The problem is that to cooperate nicely with C Ada has to go trough C stdio interface. Since Ada and C semantics differ Ada cannot use C block input. The problem is magnified becouse each C stdio function performs locking. -- Waldek Hebisch hebisch@math.uni.wroc.pl or hebisch@hera.math.uni.wroc.pl