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,22d1652a85f14a1e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-27 08:15:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!nycmny1-snf1.gtei.net!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!cyclone.swbell.net!bos-service1.ext.raytheon.com!dfw-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3E5E32A2.DA8DDA1C@raytheon.com> From: Mark Johnson X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Speeding up Ada procedure? References: <1d13e1b4.0302261526.40058154@posting.google.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 27 Feb 2003 09:45:38 -0600 NNTP-Posting-Host: 192.27.48.39 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.raytheon.com 1046360853 192.27.48.39 (Thu, 27 Feb 2003 09:47:33 CST) NNTP-Posting-Date: Thu, 27 Feb 2003 09:47:33 CST Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:34677 Date: 2003-02-27T09:45:38-06:00 List-Id: Papandopulo wrote: > > I have certain procedures dealing with > large arrays which are potential performance > bottlenecks. While they didn't cause > performance problems yet I intuitively > feel they will. > Hmm. Have you tried measuring the performance of the routines in question? I have found that my "intuition" (and others) fails to find the real problem area more often than not. An example of some code I had to fix was a Jovial to Ada translator. The developer knew that symbol lookup needed to be fast so did a pragma (Inline) to speed it up. When I fed a large file (say 3000 lines) with a lot of symbols, the program ran really slow (over two CPU days - never finished). A profile did not find the problem until I removed that pragma (Inline) and then 99.999...% of the CPU time was in that symbol lookup routine. The lookup method was a linear search of an unsorted list! We changed it to a hash table & the CPU time for that one file went to less than 5 minutes. Remember - measure before optimizing. Then fix the "right thing". > Is it a way to remove runtime array > bounds and other checks for particular > procedure ? > As several others have mentioned pragma (Suppress). However I don't recommend it; like inline it may hide the real problem. > While Ada checks are excellent on > control-type part of program where is > a lot of logic and not much time spent > it can become deadly if massive arrays > of data are being processed. > I would not be so sure of that. Again you need to do the measurements. If the arrays are as massive as you say they are - the compiler can do the check of an index against the limit once or twice (say to the min / max values of a loop) which is negligible overhead for a 1000 element array. See what your compiler does or measure it before taking that optimization step. > If the procedure just takes an array and > produces an array I can be sure it's not > faulty by testing it with different size > arrays and than turning off runtime checks. > You would be better served by using Spark or some other proving system before you make that decision. --Mark