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,10c4f504305837f2,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-13 01:38:35 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!news2.euro.net!newsfeed.vmunix.org!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Efficient Stream_IO Date: Tue, 13 Apr 2004 08:38:34 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1081845514 6010 217.17.192.37 (13 Apr 2004 08:38:34 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Tue, 13 Apr 2004 08:38:34 +0000 (UTC) User-Agent: slrn/0.9.8.0 (Linux) Xref: archiver1.google.com comp.lang.ada:7035 Date: 2004-04-13T08:38:34+00:00 List-Id: Is there a portable way to implement efficient IO on streams? Especially String to Stream_Element_Array conversions? I do have the problem, that my Ada implementation of a netflow collector requires considerably more CPU cycles than the C implementation. Of course, I have to profile the code in detail, but I suspect String'Read/Write as iterated Character'Reads/Writes as a major contribution. An unportable implementation would be: -- Don't do this! procedure Put(Stream : access Root_Stream_Type'Class; s : String) is data : Stream_Element_Array(1 .. s'Length); pragma Import(Ada, data); for data'Address use s'Address; pragma Assert(Stream_Element_Array'Component_Size = String'Component_Size); pragma Assert(data'Size = s'Size); begin Write(Stream, data); end Put;