Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!akgua!mcnc!decvax!cca!ima!inmet!jc From: jc@inmet.UUCP Newsgroups: net.unix-wizards Subject: Re: long vs. int vs. short guidelines (e - (nf) Message-ID: <1294@inmet.UUCP> Date: Thu, 19-Apr-84 06:20:13 EST Article-I.D.: inmet.1294 Posted: Thu Apr 19 06:20:13 1984 Date-Received: Sun, 22-Apr-84 08:30:33 EST Lines: 22 #R:burl:-43000:inmet:10300013:000:995 inmet!jc Apr 18 14:20:00 1984 ...int is the natural size suggested by the machine architecture, i.e., faster. Not on the VAX it ain't. I recently did a bunch of timing tests on an 11, a VAX, and a 68000. On the latter machines, replacing short with int caused the times to increase, sometimes dramatically (50% or more). Furthermore, storing a boolean as a short was consistently slower than as a char, even on the so-called 32-bit machines. My suggestion (for what it's worth) is to use pseudo-types for all globals, and for all params and locals that aren't registers. Registers are usually coerced to int or long anyway, so I don't bother with them. Incidentally, some of my tests (especially on a 4341 running Amdahl's UTS) ran faster if I didn't use registers, but let the compiler do its own allocation. One the other hand, on the 11 and VAX, the version with registers was usually faster. Maybe you should use a pseudo-type even for register variables. ...jc!inmet ----------