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: 103376,8de7eedad50552f1 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!irazu.switch.ch!switch.ch!newsfeed3.funet.fi!newsfeeds.funet.fi!feeder2.news.jippii.net!reader1.news.jippii.net!53ab2750!not-for-mail From: Tapio Kelloniemi Subject: Re: Ada bench : count words References: Newsgroups: comp.lang.ada Message-ID: Date: Wed, 23 Mar 2005 19:54:50 GMT NNTP-Posting-Host: 217.30.176.187 X-Complaints-To: newsmaster@saunalahti.com X-Trace: reader1.news.jippii.net 1111607690 217.30.176.187 (Wed, 23 Mar 2005 21:54:50 EET) NNTP-Posting-Date: Wed, 23 Mar 2005 21:54:50 EET Organization: Saunalahti Customer Xref: g2news1.google.com comp.lang.ada:9820 Date: 2005-03-23T19:54:50+00:00 List-Id: tmoran@acm.org wrote: > In my (minimal) trial, Dmitry A. Kazakov's >(Message-ID: <1j5jfikipztuc.jx5n2zhbg2np$.dlg@40tude.net>) >appears still faster. I don't understand why, unless Gnat.OS.Lib is >significantly faster than Gnat's Ada.Streams.Read, which seems unlikely. Remember that GNAT.OS_Lib just calls read(2). Stream_IO's read performs additional checking and calculations. Also File_Type is a tagged type, but I'm not sure how much overhead it causes, IIRC it is a controlled type. Also Stream_IO (and all other file IO in GNAT) are based on C streams which introduces yet some more complexity and buffering. Perhaps replacing Dmitry-version's Is_Control_Character function with the array scheme would result in fastest operation (provided that -gnatp is used, as it should be). -- Tapio