www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1999/05/10/09:02:59

Message-Id: <m10gpft-001mHUC@Dirac.Chemie.FU-Berlin.DE>
From: melchers AT chemie DOT fu-berlin DOT de (Bernd Melchers)
Subject: Re: Optimization question
To: pgcc AT delorie DOT com
Date: Mon, 10 May 1999 15:00:49 +0200 (MEST)
In-Reply-To: <Pine.SOL.3.96.990510125208.12696D-100000@ursa.cus.cam.ac.uk> from "Dr H. T. Leung" at May 10, 99 01:07:16 pm
X-Mailer: ELM [version 2.4 PL24 ME8d]
MIME-Version: 1.0
Reply-To: pgcc AT delorie DOT com
X-Mailing-List: pgcc AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

'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). 
> 
> Your codes are very badly written (probably generated by automatic
> symbolic algebra packages like reduce/mathematica?). 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

good compilers should optimize such expressions by itself, the method is
called "common subexpression optimization".

Ciao
Bernd


-- 
Bernd Melchers             | melchers AT FU-Berlin DOT DE
Freie Universitaet Berlin  | "We don't write software, we compose it."
AG Macromolecular Modelling - Prof. Dr. E.W. Knapp
for more information see http://userpage.chemie.fu-berlin.de/~melchers/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019