comp.lang.ada
 help / color / mirror / Atom feed
* Efficient Stream_IO
@ 2004-04-13  8:38 Lutz Donnerhacke
  2004-04-13 11:12 ` Stephen Leake
  0 siblings, 1 reply; 5+ messages in thread
From: Lutz Donnerhacke @ 2004-04-13  8:38 UTC (permalink / 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;



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-15  8:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-13  8:38 Efficient Stream_IO Lutz Donnerhacke
2004-04-13 11:12 ` Stephen Leake
2004-04-13 11:32   ` Lutz Donnerhacke
2004-04-14 19:54     ` Pascal Obry
2004-04-15  8:13       ` Martin Dowie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox