performance measurements

Each table row shows performance measurements for this Ada 2005 GNAT program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
500,0007.264.8518,016560  63% 10% 5% 64%
5,000,00081.8357.3718,020560  30% 40% 39% 27%
50,000,000829.81598.9818,000560  34% 34% 32% 33%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read thread-ring benchmark to see what this program should do.


GNAT 4.6

gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

 thread-ring Ada 2005 GNAT #2 program source code

-- The Computer Language Benchmarks Game
-- Contributed by Jacob Sparre Andersen (with help from Alex Mason)
-- Compile with:
--    gnatmake -gnat05 -gnatE -gnato -gnatv -gnati1 -gnatf -m -O3 -funroll-loops -funwind-tables -gnatn -fomit-frame-pointer -march=native thread_ring

with Ada.Text_IO;
with Ada.Command_line;

procedure ThreadRing is
   Ring_Size : constant := 503;
   type Ring_Index is mod Ring_Size;

   package Ring_Text_IO is new Ada.Text_IO.Modular_IO (Ring_Index);

   protected type Store is
      entry Put  (Item : in     Integer);
      entry Take (Item :    out Integer);
      Value : Integer;
      Full  : Boolean := False;
   end Store;

   protected body Store is
      entry Put (Item : in     Integer) when not Full is
         Value := Item;
         Full := True;
      end Put;

      entry Take (Item :    out Integer) when Full is
         Item := Value;
         Full := False;
      end Take;
   end Store;

   type Store_Ring is array (Ring_Index) of Store;
   Stores : Store_Ring;

   task type Node is
      entry Initialize (Identifier  : in     Ring_Index);
   end Node;

   task body Node is
      ID    : Ring_Index;
      Token : Integer;
      accept Initialize (Identifier  : in     Ring_Index) do
         ID := Identifier;
      end Initialize;

         Stores (ID).Take (Token);

         if Token = 0 then
            Ring_Text_IO.Put (ID, Width => 0);
         end if;

         Stores (ID + 1).Put (Token - 1);

         exit when Token < 0;
      end loop;
   end Node;

   type Node_Ring is array (Ring_Index) of Node;
   Nodes : Node_Ring;
   for ID in Nodes'Range loop
      Nodes (ID).Initialize (Identifier => ID);
   end loop;

   Stores (1).Put (Integer'Value (Ada.Command_Line.Argument (1)));
end ThreadRing;

 make, command-line, and program output logs

Sun, 27 Apr 2014 02:28:48 GMT

/usr/bin/gnatchop -r -w threadring.gnat-2.gnat
splitting threadring.gnat-2.gnat into:
/usr/bin/gnatmake -O3 -fomit-frame-pointer -march=native -msse3 -mfpmath=sse -gnatNp -f threadring.adb -o threadring.gnat-2.gnat_run 
gcc-4.6 -c -O3 -fomit-frame-pointer -march=native -msse3 -mfpmath=sse -gnatNp threadring.adb
gnatbind -x threadring.ali
gnatlink threadring.ali -O3 -fomit-frame-pointer -march=native -msse3 -mfpmath=sse -o threadring.gnat-2.gnat_run
0.48s to complete and log all make actions

./threadring.gnat-2.gnat_run 50000000


Revised BSD license

  Home   Conclusions   License   Play