From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Efficient Stream_IO
Date: Tue, 13 Apr 2004 08:38:34 +0000 (UTC)
Date: 2004-04-13T08:38:34+00:00 [thread overview]
Message-ID: <slrnc7n9oa.oj.lutz@taranis.iks-jena.de> (raw)
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;
next reply other threads:[~2004-04-13 8:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-13 8:38 Lutz Donnerhacke [this message]
2004-04-13 11:12 ` Efficient Stream_IO Stephen Leake
2004-04-13 11:32 ` Lutz Donnerhacke
2004-04-14 19:54 ` Pascal Obry
2004-04-15 8:13 ` Martin Dowie
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox