Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!stanford.edu!leland.Stanford.EDU!elaine18.Stanford.EDU!dhinds From: dhinds@elaine18.Stanford.EDU (David Hinds) Newsgroups: comp.lang.modula2 Subject: Re: TopSpeed 3.0 First Impressions Message-ID: <1991Jun25.172455.12384@leland.Stanford.EDU> Date: 25 Jun 91 17:24:55 GMT References: <56F0AA44FD1F400E38@EMBL-Heidelberg.DE> <9782@sail.LABS.TEK.COM> <11710@ifi.informatik.uni-stuttgart.de> Sender: news@leland.Stanford.EDU (Mr News) Organization: Stanford University - AIR Lines: 45 In article <11710@ifi.informatik.uni-stuttgart.de> schoebel@bs3.informatik.uni-stuttgart.de (Thomas Schoebel) writes: > >I also played with calling conventions, with a surprising result: >Changing the calling conventions from JPI to STACK decreases the >code size by nearly 10%! However, without adapting some assembler >routines this code will not run, I just wanted to see the size. >Surprise: With STACK conventions, the size produced by V3.01 is >nearly the same as with V1.X (188K EXE, all checks on, full optimize). >*Not* worse than V1.X! This may be a classic speed vs. size tradeoff. >Consequences: >The JPI conventions give only some gain at routines with small parameter >sets. As soon as a routine calls another or the size of it is more than >a trivial one, you can examine a push orgy in the called routine >where all parameters are moved to stack. In fairly large systems, >only a small percentage of all routines are small and trivial enough >to get advantage from register passing. In most cases it produces >additional overhead! Whether the execution time will be affected from >that is not sure, but it is most likely that larger code will run slower. >If JPI had choosen the old stack passing convention as default, their >product would be better in general. This is quite a strong claim, and I'm not at all sure it is valid. Many very serious compilers (the MIPS RISC compiler backend, for example) that are state of the art in optimization pass some parameters in registers. The MIPS compilers pass the first three or four word-sized parameters this way. The push orgy you complain about would seem to be equivalent to the push orgy that would have been done if the parameters had to be put on the stack in the first place, right? You also over-generalize about properties of procedures in large systems. Can you show some evidence of this claim, such as, that the most time-critical procedures in "large systems" tend to both have many parameters and also do relatively little work (if they do a lot of work, the overhead of passing parameters one way or another is insignificant)? I guess you could argue that the 80x86 machines don't have enough registers to justify using any of them to pass parameters, even transiently. Or that the JPI compiler isn't strong enough at optimization to minimize the overhead. But you should have some timing data before you make this claim (based only on program size, as far as I can tell). -David Hinds dhinds@cb-iris.stanford.edu