Language comparisons

Grant Edwards grante at
Wed May 9 14:44:50 EDT 2001

In article <uu22u8jfn.fsf at>, Ben Hutchings wrote:

>> For most of my career I've been working with compilers targetted at
>> register-scarce 8 and 16 bit processors with no pipelines and no
>> cache. With those compilers the code generated was quite
>> predictable, and it behooved the programmer to know whether indexing
>> through an array or incrementing a pointer through an array were
>> faster for a particular architecture.
>That's a 'feature' of old simple-minded compilers, not of their target

For a given machine, incrementing and index or incrementing a
pointer may result in drastically different execution times for
a loop. An optimizing compiler could recognize a for loop thats
looping through an array (using either method) and do the
fastest thing (converting to the other method if required), but
in the past very few did.

>Regardless of which of those two ways you write your
>iteration, a current C compiler will generate code that iterates in
>whichever way is likely to be fastest on the target machines (if you
>turn on basic optimisations) - whether those target machines use
>68000-derivatives or UltraSparcs.

But compilers will only convert simple loops.  I've never seen
one convert more comlex algorithms between indexes and

Grant Edwards                   grante             Yow!  I'm in ATLANTIC CITY
                                  at               riding in a comfortable
                                 ROLLING CHAIR...

More information about the Python-list mailing list