Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: fast array calculation in C
Date: 1999/10/07	[thread overview]
Message-ID: <37FCEB06.5F23041F@ife.ee.ethz.ch> (raw)

Hi

I'm trying to do fast arrays/matrixes/vectors in C
Not easy

I've found that looking at the produces assembler is important.
In my case, the Compaq ccc compiler produces nearly three times faster
code than gcc. It gets dependencies much better.

I've found that the biggest difference in code efficience comes if the
compiler thinks that lvalue and rvalue accesses could be the same
address or not. By feeding the produced assembler into a short Perl
script, I was able to identify ugly code, optimize it and shave 30% of
the execution time of a 700 line function by optimizing 4 lines.

I'll post the perl-script for those who are interested.
It finds the lines where the target of a ldt/addt/mult/subt function
appears in the following line, which means pipeline stalls:

- Alex


**************Listing of find_stalls ***************
#!/usr/bin/perl -wlp
# usage:
#objdump -d myobject.o | find_stalls|more
#then search for UGLY!
use strict;
use vars qw/$target/;
BEGIN {$target = "alotta garbaga"}

chomp;
$_ .= "\t\t#UGLY!!" if /\Q$target,/;

$target = "allotta garbaga";
$target = $1 if /ldt\s+(\$f\d+),/;  #target is first arg of ldt
$target = $1 if /(?:mult|subt|addt)\s+.*(\$f\d+)/; 
	#target is last arg of mlt, subt and add



             reply	other threads:[~1999-10-07  4:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-07  4:00 Alex Rhomberg [this message]
1999-10-09  4:00 ` fast array calculation in C Greg Lindahl
1999-10-11  4:00   ` Alex Rhomberg
1999-10-11  4:00     ` Greg Lindahl
1999-10-11  4:00       ` memore0
1999-10-11  4:00         ` Greg Lindahl
1999-10-12  4:00         ` Alex Rhomberg
1999-10-12  4:00           ` memore0
1999-10-12  4:00             ` Alex Rhomberg
1999-10-12  4:00           ` Eberhard Burr
1999-10-13  4:00             ` Alex Rhomberg
1999-10-13  4:00               ` Robert Harley
1999-10-12  4:00       ` Alex Rhomberg
     [not found] <3809E64D.85BDCAFC@ife.ee.ethz.ch>
     [not found] ` <7ud6gc$2o94@news2.newsguy.com>
1999-10-18  4:00   ` Alex Rhomberg
1999-10-18  4:00     ` Greg Lindahl
1999-10-18  4:00       ` Alex Rhomberg
1999-10-18  4:00   ` Emil Briggs
1999-10-18  4:00     ` Greg Lindahl
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