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,4a36b7df69d1af90 X-Google-Attributes: gid103376,public From: hugin777@my-deja.com Subject: Re: Announcing JGNAT public version 1.0p Date: 2000/04/10 Message-ID: <8ct83j$ho3$1@nnrp1.deja.com>#1/1 X-Deja-AN: 609208873 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> <8cs4ad$ft3$1@clnews.edf.fr> X-Http-Proxy: 1.0 x25.deja.com:80 (Squid/1.1.22) for client 212.242.3.28 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Apr 10 18:55:55 2000 GMT X-MyDeja-Info: XMYDJUIDhugin777 Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (Win95; U) Date: 2000-04-10T00:00:00+00:00 List-Id: In article <8cs4ad$ft3$1@clnews.edf.fr>, "Pascal Obry" 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 :) > > if (isPrime[i] && i % divisor == 0) isPrime[i] = false; > > if i mod Divisor = 0 then Is_Prime (i) := false; end if; > 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... Thanks a lot ! As you can imaging I feel a bit stupid. But what worries me even more is that the Java version still is consistently faster (but not so much any more) even with the same algorithm (even tried with various combinations of -O2, -O3, -gnatp, Component_Size=1,8,32 &c) !! If Robert Dewar is right and it isn't caused by Pentium optimizations then IBM truly does magic ! How can it be faster when it has to be profiled, JIT'ed and _then_ run at full speed ? Amazing... Or maybe I have overlooked something else. I think I will go back to just lurking for a while :-) Keep up the good work ! PS: I do not really _want_ to calculate primes :-) I just wanted to see how it looked like in ML, Ada and Java. But when I ran it I got a surprise !! PPS: I have just begun studying CS in Denmark (DIKU, Copenhagen), where they apparently love ML. I haven't met others interested in Ada yet. They all seem to prefer the short'n'fast way of ML; sadly. Maybe there's no hope for them... ;-) PPPS: Please educate me as to where I would find a better algorithm! Regards, Jens Jakob Jensen. Sent via Deja.com http://www.deja.com/ Before you buy.