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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-05 00:55:53 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!HSNX.atgi.net!newsfeed.frii.net!newsfeed.frii.net!news-out.newsfeeds.com!propagator2-maxim!news-in.superfeed.net!dax.net!juliett.dax.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X References: <7vu1b640gf.fsf@vlinux.voxelvision.no> <7vllwh53ei.fsf@vlinux.voxelvision.no> From: Ole-Hjalmar Kristensen Message-ID: <7v4r353qn2.fsf@vlinux.voxelvision.no> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 05 Jun 2003 07:55:14 GMT NNTP-Posting-Host: 193.216.12.150 X-Complaints-To: abuse@tele2.no X-Trace: juliett.dax.net 1054799714 193.216.12.150 (Thu, 05 Jun 2003 09:55:14 MET DST) NNTP-Posting-Date: Thu, 05 Jun 2003 09:55:14 MET DST Organization: Tele2 Norway AS Public Access Xref: archiver1.google.com comp.lang.ada:38664 Date: 2003-06-05T07:55:14+00:00 List-Id: Bill Findlay writes: > On 4/6/03 15:21, in article 7vllwh53ei.fsf@vlinux.voxelvision.no, > "Ole-Hjalmar Kristensen" wrote: > > > Bill Findlay writes: > > > >> On 4/6/03 11:10, in article 7vu1b640gf.fsf@vlinux.voxelvision.no, > >> "Ole-Hjalmar Kristensen" wrote: > >> > >>> I think the difference between C++ and Ada is the compiler. I run both > >>> through gcc, and got identical results. > >> > >> They are far from identical, AFAICS. > >> You show the Ada code as being 10 times faster, at 0.200s user-mode CPU time > >> for C++ matrix_c, 0.030s for Ada matrix_fun, and 0.010s for matrix_proc : > >> > > > > > Well, yes, but the clock time is the same. It's an otherwise unloaded > > system, and I get repeatable results, so I suspect there's something > > funny going on with the user time measurements. Besides, a user time > > of 0.01 seconds would indicate 10**10 additions per second, and I > > don't believe my computer is quite as fast as that. > > Even the 0.2s real time indicates a rate of order 10**9 per second. > Is your computer really that fast, or could the Ada optimizer have turned > most of the additions into zero-time operations? 8-) > > -- > Bill-Findlay chez blue-yonder.co.uk ("-" => "") > > I suspect that the matrices are small enough that both code and data are predominantly in the cache, and in that case, it should be that fast. Here is the assembler listing, and it certainly looks like it's adding: .file "matrix_proc.adb" gcc2_compiled.: ___gnu_compiled_ada: .text .align 4 _matrix_proc__add.0: pushl %ebp movl %esp,%ebp subl $8,%esp pushl %edi pushl %esi movl $400,%edi pushl %ebx movl 12(%ebp),%esi movl %ecx,-4(%ebp) movl $1,-8(%ebp) movl 8(%ebp),%ecx .align 2,0x90 L6: movl $1,%ebx leal 4(%edi),%edx .align 2,0x90 L10: movl -404(%ecx,%edx),%eax addl -404(%esi,%edx),%eax movl %eax,-404(%ecx,%edx) movl -400(%ecx,%edx),%eax addl -400(%esi,%edx),%eax movl %eax,-400(%ecx,%edx) movl -396(%ecx,%edx),%eax addl -396(%esi,%edx),%eax movl %eax,-396(%ecx,%edx) movl -392(%ecx,%edx),%eax addl -392(%esi,%edx),%eax movl %eax,-392(%ecx,%edx) movl -388(%ecx,%edx),%eax addl -388(%esi,%edx),%eax movl %eax,-388(%ecx,%edx) addl $5,%ebx addl $20,%edx cmpl $100,%ebx jle L10 addl $400,%edi incl -8(%ebp) cmpl $100,-8(%ebp) jle L6 leal -20(%ebp),%esp popl %ebx popl %esi popl %edi movl %ebp,%esp popl %ebp ret .align 4 .globl __ada_matrix_proc __ada_matrix_proc: pushl %ebp movl $80008,%eax movl %esp,%ebp call __alloca pushl %edi pushl %esi pushl %ebx leal -40000(%ebp),%edx movl $1,-80004(%ebp) leal -80000(%ebp),%ebx .align 2,0x90 L18: movl $1,-80008(%ebp) movl $400,%edi .align 2,0x90 L21: movl $1,%esi leal 4(%edi),%ecx .align 2,0x90 L24: movl -404(%edx,%ecx),%eax addl -404(%ebx,%ecx),%eax movl %eax,-404(%edx,%ecx) movl -400(%edx,%ecx),%eax addl -400(%ebx,%ecx),%eax movl %eax,-400(%edx,%ecx) movl -396(%edx,%ecx),%eax addl -396(%ebx,%ecx),%eax movl %eax,-396(%edx,%ecx) movl -392(%edx,%ecx),%eax addl -392(%ebx,%ecx),%eax movl %eax,-392(%edx,%ecx) movl -388(%edx,%ecx),%eax addl -388(%ebx,%ecx),%eax movl %eax,-388(%edx,%ecx) addl $5,%esi addl $20,%ecx cmpl $100,%esi jle L24 addl $400,%edi incl -80008(%ebp) cmpl $100,-80008(%ebp) jle L21 incl -80004(%ebp) cmpl $10000,-80004(%ebp) jle L18 leal -80020(%ebp),%esp popl %ebx popl %esi popl %edi movl %ebp,%esp popl %ebp ret -- Ole-Hj. Kristensen ****************************************************************************** * You cannot consistently believe this sentence. ******************************************************************************