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=2.2 required=5.0 tests=BAYES_00,INVALID_MSGID, PDS_OTHER_BAD_TLD,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bcdac28207102750 X-Google-Attributes: gid103376,public From: "Clifford J. Nelson" Subject: Ada95 speed Date: 1999/05/18 Message-ID: <3740C535.7C6200A8@gte.net>#1/1 X-Deja-AN: 479239407 Distribution: world Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353" X-Abuse-Info: Otherwise we will be unable to process your complaint properly X-Complaints-To: abuse@gte.net X-Trace: +Li/tVJcHGLDWA4LORfU09oMRgWK/T7EgZCDd5Y45b2GAC9qQ2DRixINa9adQPo7mGqgJktpGRuC!MKMpt6waO2wOPa1odsN7SKydcyPQ3oPgtzPgtOgn+GPi1a2OlnKkZg== MIME-Version: 1.0 Reply-To: cnelson9@gte.net NNTP-Posting-Date: Tue, 18 May 1999 00:47:22 GMT Newsgroups: comp.lang.ada Date: 1999-05-18T00:00:00+00:00 List-Id: Ten years ago a Mandelbrot set computation and display on a 1200x700 screen with eight bit color took six seconds in C on a MacIIfx. The following computations (leaving out all the with statements that you need for the Mac) take ten seconds on an iMac 266 MHertz Mac OS 8.5.1 with the CodeBuilder Ada95 GNU from Tenon. I think it should run ten times faster. Is Ada95 slow in order to be safe? Is GNU Ada95 slower than most Adas? Is the iMac slow? Mac OS 8.5.1 slow? CodeBuilder? Why does it take so long? Program follows-------- with Ada.Numerics.Complex_Types; use Ada.Numerics.Complex_Types; procedure Mandel is -- Initialize procedure goes here for windRect.bottom and windRect.top procedure Display(Mag : in Float) is It : Integer; X, Y : Float; C, Z : Complex; Num_Iters : constant := 64; Vertical_Maximum : constant Short_Integer := windRect.bottom; Horizontal_Maximum : constant Short_Integer := windRect.Right; Ver_Size : constant Float := Float(Vertical_Maximum + 1); Hor_Size : constant Float := Float(Horizontal_Maximum + 1); StartY : constant Float := -Mag * Ver_Size; StartX : constant Float := -Mag * Hor_Size; Step : constant Float := 2.0 * Mag ; begin Y := StartY; for Y_Pos in windRect.top..windrect.bottom - 1 loop X := StartX; for X_Pos in windRect.left..windRect.right loop Z := (X, Y); -- Complex value; standard Ada 95! C := Z; for I in 0..Num_Iters loop It := I; exit when (abs( Z)) > 2.0; Z := Z * Z + C; -- Complex arithmetic end loop; -- draw pixel here in color depending on variable It. X := X + Step; end loop; Y := Y + Step; end loop; end Display; begin -- Main body of program Mandel Initialize; Display(0.0025); -- draw the fractal! loop exit when Events.Button; end loop; end Mandel;