openbsd-misc
[Top] [All Lists]

Re: Speed optimization of a C program

To: Stoyan Genov <sdg@rila.bg>
Subject: Re: Speed optimization of a C program
From: Ted U <grendel@heorot.stanford.edu>
Date: Thu, 28 Feb 2002 12:36:38 -0800 (PST)
Cc: misc@openbsd.org
In-reply-to: <20020228173935.40681472.sdg@rila.bg>
Organization: Mead Halls Inc.
Sender: owner-misc@openbsd.org
On Thu, 28 Feb 2002, Stoyan Genov wrote:

> 2) Apart from optimizing my code (which I think I have done to a
> reasonable extend), is my only option for speeding up things recompiling
> libc and libm with -O6 (or getting hands on some 2G processor :-)) ?

That's probably a bad idea.  O6 can run slower in some cases, and it's not
guarenteed to work right.  Hand tune some of the assembly.  Whether it's
worthwhile to recompile with -march=586 is up to you, but that sometimes
overoptimizes too.  Try a few variations and see.

Have you looked at fast math libraries?  DJB has some that work really
fast, don't know about any trig functions.  Another option is to use a
different sort, depending on how much order is already in the data.

--
Ted, toll collector of the information superhighway

<Prev in Thread] Current Thread [Next in Thread>