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,70d59e24bec599dc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-23 11:25:49 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!sjc-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!kilgallen From: Kilgallen@eisner.decus.org.nospam (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: Profiling Gnat re. pthread_malloc, pthread_getspecific, system Message-ID: References: <3B344689.8A79ED4F@mullum.com.au> Organization: LJK Software Date: 23 Jun 2001 05:57:33 -0500 NNTP-Posting-Host: 216.44.122.34 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 993290257 216.44.122.34 (Sat, 23 Jun 2001 09:57:37 GMT) NNTP-Posting-Date: Sat, 23 Jun 2001 09:57:37 GMT Xref: archiver1.google.com comp.lang.ada:9060 Date: 2001-06-23T05:57:33-05:00 List-Id: In article <3B344689.8A79ED4F@mullum.com.au>, Charles Darcy writes: > I've profiled an Ada program, which I converted from c++, so that I > might learn why the Ada program performs worse than the c++ version > (approx. 10 times slower). I'm using Gnat 3.13p and gprof on a Linux > (Mandrake 8.0) machine. I've used inlining, O3 optimisation, and > disabled all run-time checks. > > The profile results (below) seem to indicate that pthread_malloc, > pthread_getspecific consume a large portion of processing time, but > these functions are a mystery to me. Is there any way to reduce the > performance cost of these functions ? I am not familiar with your analysis tool, but I would suggest considering whether the C++ version uses the same pthread_ calls and uses them an equivalent number of times in a run against some fixed input data. Just by the name, pthread_malloc would seem it could not be any more efficient than ordinary malloc, although it might be equal on your platform. > I'm new to Ada, and afraid I may have inadvertantly used the > language in an improper fashion, resulting in poor performance. > My thanks to anyone who can enlighten me as to what might be done to > eliminate any unnecessary performance overhead. That is a possibility. Someone familiar with Ada might be able to look at your code and see if it resembles "C++ style" more than Ada style. You might also consider whether it is possible to experiment with your program on a different Ada compiler and operating system. It could be there is something in your algorithm that happens to hit a weak point in GNAT.