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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,325a055bed62c230 X-Google-Attributes: gid103376,public From: reason67@my-deja.com Subject: Re: Apex vs GNAT on solaris Date: 1999/12/07 Message-ID: <82hk5c$80p$1@nnrp1.deja.com>#1/1 X-Deja-AN: 557292324 References: <82hiuj$74o$1@nnrp1.deja.com> X-Http-Proxy: NetCache@www-blv-proxy3.boeing.com: Version NetApp Release 3.4D6: Mon Aug 23 16:40:19 PDT 1999-Solaris, 1.0 x32.deja.com:80 (Squid/1.1.22) for client 12.13.226.13 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Dec 07 00:25:21 1999 GMT X-MyDeja-Info: XMYDJUIDreason67 Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.06 [en] (X11; I; SunOS 5.6 sun4u) Date: 1999-12-07T00:00:00+00:00 List-Id: > 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.