X-Authentication-Warning: sal.physics.ucsb.edu: dwhysong owned process doing -bs Date: Mon, 10 May 1999 09:09:25 -0700 (PDT) From: David Whysong To: "Dr H. T. Leung" cc: pgcc AT delorie DOT com Subject: Re: Optimization question In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: pgcc AT delorie DOT com X-Mailing-List: pgcc AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 10 May 1999, Dr H. T. Leung wrote: >If you had read the mailing list archive, it is terribly unfair to people >on the list to cc you replies when you are not on the list. If you want to >ask a question, subscribe, read on for a while, then post (then maybe >unsubscribe). That's EXTREMELY strange. Anyway I'm now subscribed to the list. Sorry... >Your codes are very badly written (probably generated by automatic >symbolic algebra packages like reduce/mathematica?). Yes, though I've done a lot of work on it by hand. >An optimized compiler can't help you much if your codes doesn't let >itself be optimized. For a very simple example, You were doing >multipication "Pv1*v01" 4 times; that means retrieves 2 values from >memory, multiply, store it back, done 4 times. Whereas you could have >defined a new variable "Pv1_v01 = Pv1*v01", then it is two retrievals, >multiplication once, storage once, then retrieval 4 times. You would be >much better off spending some time defining new variables like this and >break down your calculation so that it doesn't re-do little >multiplications like this; Thanks, this is exactly what I wanted to know. Optimizing comiplers like egcs/pgcc do "strength reduction", but I wasn't sure if this kind of construct would be taken care of by the compiler, or if I need to do it by hand. I guess I have more work to do. >pgcc can only bring you 10-20% speed improvement, but if speed is really >important for you, you should rewrite your codes as detailed above so >that simple operations are not repeated. But of course, don't over-do it >- storage and retrival from memory to the cache also takes time. According to my timing tests pgcc hasn't gained me anything over egcs so far, but I keep hoping. >Good luck and have fun rewriting the codes. Relativity is not meant to be >that terrible algebra-wise. (yes, I am a physicist...) Believe it or not, this isn't even relativistic, though I've done relativistic dynamics before. This is a KS-regularized 2-body Newtonian dynamics solution, essentially an analytic solution to a 4-D perturbed harmonic oscillator equation. The form of the perturbation term is particularly ugly. Dave David Whysong dwhysong AT physics DOT ucsb DOT edu Astrophysics graduate student University of California, Santa Barbara My public PGP keys are on my web page - http://www.physics.ucsb.edu/~dwhysong DSS PGP Key 0x903F5BD6 : FE78 91FE 4508 106F 7C88 1706 B792 6995 903F 5BD6 D-H PGP key 0x5DAB0F91 : BC33 0F36 FCCD E72C 441F 663A 72ED 7FB7 5DAB 0F91