From: reason67@my-deja.com
Subject: Re: Apex vs GNAT on solaris
Date: 1999/12/07
Date: 1999-12-07T00:00:00+00:00 [thread overview]
Message-ID: <82hk5c$80p$1@nnrp1.deja.com> (raw)
In-Reply-To: 82hiuj$74o$1@nnrp1.deja.com
> 3.1 timing of allocation and deallocation of 1 .. 1 meg of
memory
-=-=-=-=-=-=-=-
with Ada.Calendar;
with Ada.Text_Io;
with Ada.Unchecked_Deallocation;
with System;
with System.Address_To_Access_Conversions;
with System.Storage_Elements;
procedure Aaaa_3_1_Malloc is
package D_Io is new Ada.Text_Io.Fixed_Io (Duration);
function "-" (Left : in Ada.Calendar.Time; Right : in
Ada.Calendar.Time)
return Duration renames Ada.Calendar."-";
type Byte is mod 256;
subtype Index_Type is Integer range 0 .. 1048476;
type Byte_Array_Type is array (Index_Type range <>) of Byte;
package Converter is
new System.Address_To_Access_Conversions (Byte_Array_Type);
procedure Free is new Ada.Unchecked_Deallocation
(Byte_Array_Type,
Converter.Object_Pointer);
Current : Converter.Object_Pointer;
Last : Converter.Object_Pointer;
Address : System.Address;
Start_Time : Ada.Calendar.Time;
Stop_Time : Ada.Calendar.Time;
Alloc_File : Ada.Text_Io.File_Type;
Dealloc_File : Ada.Text_Io.File_Type;
function Create (Length : in Index_Type) return
Converter.Object_Pointer is
Result : Converter.Object_Pointer;
begin
Start_Time := Ada.Calendar.Clock;
Result := new Byte_Array_Type (1 .. Length);
Stop_Time := Ada.Calendar.Clock;
return Result;
end Create;
begin
Ada.Text_Io.Create (File => Alloc_File, Name =>
"allocation_times.txt");
Ada.Text_Io.Create (File => Dealloc_File, Name =>
"deallocation_times.txt");
Current := Create (1);
D_Io.Put (Alloc_File, (Stop_Time - Start_Time));
Ada.Text_Io.New_Line (Alloc_File);
Last := Current;
Current := Create (2);
D_Io.Put (Alloc_File, (Stop_Time - Start_Time));
Ada.Text_Io.New_Line (Alloc_File);
for Index in 3 .. Index_Type'Last loop
Start_Time := Ada.Calendar.Clock;
Free (Last);
Stop_Time := Ada.Calendar.Clock;
D_Io.Put (Dealloc_File, (Stop_Time - Start_Time));
Ada.Text_Io.New_Line (Dealloc_File);
Last := Current;
Current := Create (Index);
D_Io.Put (Alloc_File, (Stop_Time - Start_Time));
Ada.Text_Io.New_Line (Alloc_File);
end loop;
Start_Time := Ada.Calendar.Clock;
Free (Last);
Stop_Time := Ada.Calendar.Clock;
D_Io.Put (Dealloc_File, (Stop_Time - Start_Time));
Ada.Text_Io.New_Line (Dealloc_File);
Start_Time := Ada.Calendar.Clock;
Free (Current);
Stop_Time := Ada.Calendar.Clock;
D_Io.Put (Dealloc_File, (Stop_Time - Start_Time));
Ada.Text_Io.New_Line (Dealloc_File);
end Aaaa_3_1_Malloc;
-=-=-=-=-=-=-=-
On both Apex and GNAT every result was 0.0. Memory allocation seems to
fast to measure. Any ideas of how to get accurate timing would be
appreciated.
Sent via Deja.com http://www.deja.com/
Before you buy.
next prev parent reply other threads:[~1999-12-07 0:00 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-12-07 0:00 Apex vs GNAT on solaris reason67
1999-12-07 0:00 ` reason67
1999-12-07 0:00 ` Robert Dewar
1999-12-07 0:00 ` reason67
1999-12-07 0:00 ` reason67 [this message]
1999-12-07 0:00 ` Robert Dewar
1999-12-07 0:00 ` reason67
1999-12-08 0:00 ` Robert Dewar
1999-12-08 0:00 ` reason67
1999-12-07 0:00 ` Vladimir Olensky
1999-12-07 0:00 ` Vladimir Olensky
1999-12-09 0:00 ` Geoff Bull
1999-12-09 0:00 ` Vladimir Olensky
1999-12-09 0:00 ` Vladimir Olensky
1999-12-10 0:00 ` Vladimir Olensky
1999-12-07 0:00 ` reason67
1999-12-07 0:00 ` reason67
1999-12-07 0:00 ` reason67
1999-12-07 0:00 ` Robert Dewar
1999-12-07 0:00 ` Roger Racine
1999-12-07 0:00 ` Larry Kilgallen
1999-12-07 0:00 ` Samuel T. Harris
1999-12-07 0:00 ` Jean-Pierre Rosen
1999-12-07 0:00 ` David Starner
1999-12-08 0:00 ` Robert Dewar
1999-12-08 0:00 ` Robert Dewar
1999-12-08 0:00 ` Roger Racine
1999-12-08 0:00 ` Larry Kilgallen
1999-12-08 0:00 ` Roger Racine
1999-12-08 0:00 ` Larry Kilgallen
1999-12-08 0:00 ` tmoran
1999-12-09 0:00 ` Robert Dewar
1999-12-09 0:00 ` Roger Racine
1999-12-09 0:00 ` Larry Kilgallen
1999-12-10 0:00 ` Robert Dewar
1999-12-09 0:00 ` Mike Silva
1999-12-10 0:00 ` Robert Dewar
1999-12-16 0:00 ` Stefan Skoglund
1999-12-08 0:00 ` Robert A Duff
1999-12-08 0:00 ` Ted Dennison
1999-12-07 0:00 ` reason67
1999-12-08 0:00 ` Robert Dewar
1999-12-08 0:00 ` reason67
1999-12-08 0:00 ` Larry Kilgallen
1999-12-08 0:00 ` Robert Dewar
1999-12-08 0:00 ` Robert A Duff
1999-12-07 0:00 ` reason67
1999-12-07 0:00 ` reason67
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox