Subject: RE: [hackers-il] Summary of a Bash Lecture

From: Chen Shapira <[email-masked]>
Date: Wed, 15 Nov 2000 14:30:19 +0200

> optimize rograms in any language the same. OTOH, without such 
> an oracle, 
> any optimizer works by heuristics, so what you're asking has litle
> theoreticalmeanning. 

Doesn't Compiler Theory count? 

> Also, consider the fact that 
> "optimization" is not
> well defined. If you have two programs, one that runs faster 
> on input "a",
> and one that runs faster on input "b", which one is optimal? 
> What about
> different configurations (say, some algorithms wouild cause 
> thrashing if
> there is too litle memory).

Not well defined, but pretty defined.

1. GCC has few levels of optimization so I suppose some ranking exists
2. You can use qualifiers: Optimizations for a certain type of input, for
avrage cases, worse cases. You can use some statistics to decide on that.
3. You can also qualify on the basis of side effects.

But I'm still interested in fundamental diffrences between languages. Feel
free to qualify the answer as you please.

---

From: Moshe Zadka <[email-masked]>
Date: Wed, 15 Nov 2000 14:45:40 +0200 (IST)

> Doesn't Compiler Theory count? 

Most compiler theory is about parseing, and semantics. Very little thought
has been given to optimizations.

> 1. GCC has few levels of optimization so I suppose some ranking exists

Hardly. In the real world, in performance intensive parts of applications,
no one bothers with levels: you individually turn on and off optimizations
until you reach an optimum. The "levels" are hueristics to those who want
pretty primitive optimization/compilation speed tradeoff, but are useless
for real computation bottelnecks.

> avrage cases, worse cases. You can use some statistics to decide on that.

Umm...I thought we were talking static optimizations, not JITs? The
situation in JITs is even more complicated.

> 3. You can also qualify on the basis of side effects.

Again, in the real world, in computation intensive applications, you
optimize for *one possible configuration*: you take into account specific
memory constraints and cache size. 

> free to qualify the answer as you please.

It probably depends more on the build precedure then the language. For
example, C is pretty awful because of the seperate compilation and
linkage: you can't do any meaningful whole program analysis to get any
decent invariants. 

--
Moshe Zadka <[email-masked]> -- 95855124
http://advogato.org/person/moshez