[comp.lang.postscript] Reals in PS code

jwhiting@cdp.UUCP (03/21/90)

The PS books & misc. Adobe tech notes lead me to believe that 
real numbers are faster than integers.  No type conversion.

If this is true can I further assume that " 0. " is faster 
than "0.0" which is way faster than " 0 " ?

thanks in advance,
jwhiting

cdp!jwhiting@arisia.xerox.com
cdp!jwhiting%labrea@stanford
[DE3MIR]jwhiting

batcheldern@hannah.enet.dec.com (Ned Batchelder) (03/27/90)

> The PS books & misc. Adobe tech notes lead me to believe that 
> real numbers are faster than integers.  No type conversion.
> 
> If this is true can I further assume that " 0. " is faster 
> than "0.0" which is way faster than " 0 " ?

I don't know which is faster, but I would guess that it depends on what
you are going to do with it, and on what printer. If the machine has a
really zippy processor, it might be able to do the conversion in less
time than it took to send the dot. I suggest that if you are really
desperate for speed, do some experiments in your own environment. If you
aren't really desperate, then do it whichever way feels better.

Ned Batchelder, Digital Equipment Corp., BatchelderN@Hannah.enet.DEC.com

kevin@kosman.UUCP (Kevin O'Gorman) (03/29/90)

In article <9612@shlump.nac.dec.com> batcheldern@hannah.enet.dec.com writes:
>
>> The PS books & misc. Adobe tech notes lead me to believe that 
>> real numbers are faster than integers.  No type conversion.
Providing it's being used by an operator that wants a real, of course.
>> 
>> If this is true can I further assume that " 0. " is faster 
>> than "0.0" which is way faster than " 0 " ?
>
>I don't know which is faster, but I would guess that it depends on what
>you are going to do with it, and on what printer. If the machine has a
>really zippy processor, it might be able to do the conversion in less
>time than it took to send the dot. I suggest that if you are really
>desperate for speed, do some experiments in your own environment. If you
>aren't really desperate, then do it whichever way feels better.

There's another consideration that generally weighs in favor of the
0.0 approach in certain cases.  If the constant appears in a procedure
which is executed many times, you want to have the 'natural' data type.
Transmission time is a small issue, because it is transmitted only once.
Therefore, the savings of 0. over 0.0 seem not to be worth it.

The procedure is stored with the numeric object of whatever type the
constant was coded with.  If it needs conversion every time the procedure
is executed, you're wasting time.

On the other hand, I quite agree that you may want to experiment with
different things for constants sent for immediate consumption.  At 9600
baud you're likely to come to one conclusion; on AppleTalk, another. But
then I haven't done such testing and I'm only guessing.
-- 
Kevin O'Gorman ( kevin@kosman.UUCP, kevin%kosman.uucp@nrc.com )
voice: 805-984-8042 Vital Computer Systems, 5115 Beachcomber, Oxnard, CA  93035
Non-Disclaimer: my boss is me, and he stands behind everything I say.