www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/27/17:03:28

From: Glen Miner <gminer AT ca DOT newbridge DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Optimization
Date: Wed, 27 Nov 1996 13:17:14 -0500 (EST)
Organization: Newbridge Networks Corporation
Lines: 47
Message-ID: <Pine.SUN.3.90.961127125213.12832A-100000@coop10>
NNTP-Posting-Host: 138.120.136.238
Mime-Version: 1.0
In-Reply-To: <9611271750.AA03890@cgneiss>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> : I am currently working on a program that grinds away in a recursive
> : algorithm tens of thousands of times over a small group of local data. It
> : doesn't do _any_ io, and only calls a select few functions. Due to the
> : immense number of calculations required, this is painfully slow. I've
> : optimized the algorithm a fair amount, and plan to improve it more, but
> : that is only one part of the optimization process. 
> 
> Removing the recursion may improve the performance. [...snip...]

I don't think that removing the recursion is a viable solution, and I
doubt that it would improve the algorithm's speed any: It's actually doing
a search of a very wide "tree" of "data". (Sorta like a chess move search
engine). 

The code in question makes no standard library calls, and restricts itself
to a small block of global data. There are maybe half a dozen small
functions that are used while it recurses, but they are all "home made" 
and fairly well optimized. No function used requires more then a couple 
of bytes of information, so there isn't much in the way of large memory 
movement to worry about.

I suppose I should have been more precise when I posted originally. I've 
been optimizing the algorithm for the better part of several months, and 
know full well which of my functions could do with some optimizing. 

What I'm concerned about is how well djgpp deals with the various data 
types etc. For example: if I don't really need 32bits worth of int, will 
things be faster if I declare my variables as short ints? It makes sense 
to me, but somebody sent me a mail stating the exact opposite.

How well will djgpp deal with two dimentional arrays? Say I'm stepping 
through char MyArray[9][9] like so:

  for (x = 0; x < 6; x++)
    for (y = 0; y < 7; y++)
      MyArray [x][y] = SomeValue;

Will it be smart and index it by a pointer so that it doesn't have to 
recalculate the address every time? 

Peace
===[ Gabo / [ABC] : gaminer AT undergrad DOT math DOT uwaterloo DOT ca ]===================
Latest ABC Shogi: http://www.undergrad.math.uwaterloo.ca/~gaminer/shogi.html
"What Greenpeace spends in a year General Motors spends in four hours" -Moby


- Raw text -


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