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=-0.5 required=5.0 tests=BAYES_00,INVALID_MSGID, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,4a36b7df69d1af90 X-Google-Attributes: gid103376,public From: "Pascal Obry" Subject: Re: Announcing JGNAT public version 1.0p Date: 2000/04/10 Message-ID: <8cs4ad$ft3$1@clnews.edf.fr>#1/1 X-Deja-AN: 609019816 References: <8bqd8g$sbs$1@nnrp1.deja.com> <8c2613$hce$1@nnrp1.deja.com> <8c7fh4$25g$1@nnrp1.deja.com> <8c92nl$nqn$1@nnrp1.deja.com> <8cak93$dtl$1@nnrp1.deja.com> <38EA152B.6D7A4481@earthlink.net> <1MNG4.630$n8.195854@news-east.usenetserver.com> <38ECB0CC.3B2941E2@earthlink.net> <8ckscp$nv7$1@nnrp1.deja.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: newsadm@news.edf.fr X-Trace: clnews.edf.fr 955356301 16291 130.98.42.146 (10 Apr 2000 08:45:01 GMT) Organization: EDF X-MSMail-Priority: Normal NNTP-Posting-Date: 10 Apr 2000 08:45:01 GMT Newsgroups: comp.lang.ada Date: 2000-04-10T08:45:01+00:00 List-Id: a �crit dans le message : 8ckscp$nv7$1@nnrp1.deja.com... > In article <38ECB0CC.3B2941E2@earthlink.net>, > Charles Hixson wrote: Ok, now I see the problem. You did not code the same algorithm :) Look at markMultiplum in Java you have added a first test isPrime[i] and this is not coded in Ada, most certainly this would reduce Ada time :) > // This better get inlined !! > // (Oh, well, the compiler won't read this, will it ? :-) > private static void markMultiplum(int divisor, boolean[] isPrime) { > for (int i = divisor+1; i < isPrime.length; i++) { > if (isPrime[i] && i % divisor == 0) isPrime[i] = false; > } > procedure MarkMultiplum (Divisor : in Integer; > Is_Prime : in out BoolArray) is > begin > for i in Divisor+1 .. Is_Prime'Last loop > if i mod Divisor = 0 then Is_Prime (i) := false; end if; > end loop; > end MarkMultiplum; Do you mind to try with for i in Divisor+1 .. Is_Prime'Last loop if Is_Prime (i) and then i mod Divisor = 0 then Is_Prime (i) := false; end if; end loop; And anyway this algorithm is very far from being efficient... Pascal. -- --|------------------------------------------------------------ --| Pascal Obry Team-Ada Member | --| | --| EDF-DER-IPN-SID- T T I | --| Intranet: http://cln46gb | --| Bureau N-023 e-mail: p.obry@der.edf.fr | --| 1 Av G�n�ral de Gaulle voice : +33-1-47.65.50.91 | --| 92141 Clamart CEDEX fax : +33-1-47.65.50.07 | --| FRANCE | --|------------------------------------------------------------ --| --| http://perso.wanadoo.fr/pascal.obry --| --| "The best way to travel is by means of imagination"