From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_50,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,24c284aba153bca6,start X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,24c284aba153bca6,start X-Google-Attributes: gid103376,public From: smryan@netcom.com (@#$%!?!) Subject: Re: C is 'better' than Ada because... Date: 1996/08/04 Message-ID: #1/1 X-Deja-AN: 171904050 sender: smryan@netcom2.netcom.com organization: The Programmer formerly known as S M Ryan followup-to: comp.lang.ada,comp.lang.c newsgroups: comp.lang.ada,comp.lang.c Date: 1996-08-04T00:00:00+00:00 List-Id: : Unfortunately, it's very difficult to find good examples of things : that are difficult to optimize, because a case can always be made It is quite easy. For any language. There are two parts of an optimiser: (1) can I change this program? and (2) this is how I will change the program. Part (2) is easy. Part (1) can range from easy to provably impossible. A simple case would be a nonFortran subroutine that has to be vectorised independently of its caller, copy array A to array B is for i from lwb of A to upb of A do copy A[i] to B[i] Fortran requires A and B refer to distinct memory areas, so this is immediately vectorisable. But in every other language without an alias ban this is nonvectorisable without some additional information. The more information the language provides, the better the optimiser can do part (1). If the processor has two or more add pipes, it can do two additions for the price of one. So if you have (a+b+c+d) it can be two thirds as fast to compute ((a+b)+(c+d)) instead of (((a+b)+c)+d). However addition does not reassociate in Fortran or C, so the optimiser is prevented from reparenthesising. The fewer constraints the language imposes, the better the optimiser can do part (1). -- In mirrored maze he met the Mother, | smryan@netcom.com PO Box 1563 the lost and breathless, lonely brother. | Cupertino, California Both crone and child, now crying wild, | (xxx)xxx-xxxx 95015 her clinging clay will clothe and smother. | I don't use no smileys