alphalinux.org high-perf list (1998-2001)
 help / color / mirror / Atom feed
From: Jonathan L Dubois <dubois@bec.physics.udel.edu>
Subject: request for perf improvement suggestions
Date: Wed, 25 Nov 1998 16:15:36 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.3.96.981125155452.6224A-100000@bec.physics.udel.edu> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

Hello everyone,

I have some code I would like to optomize and I could use some suggestions

and pointers for where to get started.

The function which is called most often and the most likely candidate

for improvement (I think) calculates the distance between two vectors.

The source I am currently using is locate below:

void r12(double *rij,double *x1,double *x2){

  int i;

  double tmp1,tmp2;

  tmp2 = 0;

  for(i=0;i<3;i++){

    tmp1 = x1[i]-x2[i];

    tmp2 += tmp1*tmp1;

  }

  tmp2 = sqrt(tmp2);

  *rij = tmp2;

}

my guess is that this is a pretty classic problem and there are some nifty

tricks I could apply in assembly to make this quite fast.  I'm fairly new

to this though (my only assembly experience was with the MC6800 several

years ago and I don't think I really understand all the issues involved

with optomization on a RISC chip)  So my questions are,  is this the best

form for the C code?  Is there an existing assembly routine for finding

the distance between two vectors?  If not, any suggestions for the

implementation of one?

Kind Regards,

Jonathan DuBois

             reply	other threads:[~1998-11-25 21:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-25 21:15 Jonathan L Dubois [this message]
1998-11-25 21:44 ` request for perf improvement suggestions Adam
1998-11-26  9:45 ` Stefan Schroepfer
1998-11-26 15:48 ` Joachim Wesner
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox