lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LYNX-DEV floating-point (was: using a dos xt)


From: Klaus Weide
Subject: Re: LYNX-DEV floating-point (was: using a dos xt)
Date: Sat, 2 Aug 1997 08:37:26 -0500 (CDT)

On Sat, 2 Aug 1997, David Woolley wrote:
> > On Thu, 31 Jul 1997, David Woolley wrote:
> > 
> > >  (Lynx makes heavy, unnecessary use of floating point).
> > 
> > Where?
> 
> This is the primary offender; it's used all over GridText, to such an extent
> that it was above my threshold for attempting a quick fix (I need to 
> understand
> exactly how it is used before I can safely change it, even if the change
> proves trivial):
> 
> HTStyle.h:70:typedef float HTCoord;

I wasn't aware that those various components of the HTStyle structure were
defined as floats.  The few of them that are actually used never make use
of that, as far as I have ever noticed in GridText.c or elsewhere -
except some historical code in HTStyle.c which is mostly (or completely)
commented out.  Also the initializers in DefaultStyle.c and GridText.c
use all intergers for those (except for fontSize, which isn't used
anywhere, as far as I can see).

> There are lots more uses of float which could  have been done with scaled
> integers, but this one affects every thing that has to be placed on the
> screen.  And what's worse is that Lynx only deals in integral character
> positions, so gains no benefit from working in fractions.
> 
> My guesses are that CERN people were so used to doing numerical work that
> they forgot that most systems type programs don't need to use float at all.
> 
> Going to a machine with hardware floating point makes a remarkable difference
> to the speed at which Lynx runs!
> 
> Last reported (as an explicit report on this problem) over a year ago.
>
> This is the complete grep from the WWW Library.  Some are only used on 
> a per document basis, but I can't exclude that others aren't used on a
> per tag or per anchor basis (I would want to check grey, at least):
>
[ list mostly snipped ] 
> HTStyle.h:65:        float   grey;
> HTStyle.h:70:typedef float HTCoord;

The "grey" thing isn't actually used.  All the other occurrences (and a
few in the src/ directory) are things which are not used frequently -
for example, only for initializing loading of a new document, but not
continuously during rendering.

> And HTCoord:
> 
> HTStyle.h:61:typedef NXCoord HTCoord;
> HTStyle.h:63:#define HTCoord NXCoord
(those are part of the museum whic HTStyle.c mostly is.)

> HTStyle.h:70:typedef float HTCoord;

This is the one line that should make a noticeable difference.

> HTStyle.h:73:    HTCoord     left_indent;            /* @@@@ junk! etc etc*/
> HTStyle.h:86:    HTCoord             position;       /* x coordinate for stop 
> */
> HTStyle.h:106:    HTCoord             fontSize;       /* The size of font, 
> not independent */
> HTStyle.h:114:    HTCoord             indent1st;      /* how far first line 
> in paragraph is
> HTStyle.h:116:    HTCoord             leftIndent;     /* how far second line 
> is indented */
> HTStyle.h:117:    HTCoord             rightIndent;    /* (Missing from NeXT 
> version */
> HTStyle.h:119:    HTCoord             lineHt;         /* line height */
> HTStyle.h:120:    HTCoord             descentLine;    /* descender bottom 
> from baseline */
> HTStyle.h:125:    HTCoord             spaceBefore;    /* Omissions from 
> NXTextStyle */
> HTStyle.h:126:    HTCoord             spaceAfter;

Some of those are never used, the rest as far as I know only as integers.

---- Ok, I just replaced that line with

typedef int HTCoord;

and compiled (the devel code, on SPARC Solaris).  No problem compiling,
and Lynx seems to be running just fine.

Another look at GridText.c shows that those floats were just converted to
(int) and/or assigned to int variables where they occur - (unless I
overelooked something).  The only floating-point operations which occur
frequently would then be all those conversions.  I see no reason not to
get rid of them by `typedef int HTCoord'.

   Klaus

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]