> >Who really needs this kind of optimization for Perl?
>
> I do. Lots of people with web apps do. Pretty much anyone with a large or
> long-running perl program does.

I have to say that I agree to disagree. Since it has been so controversal,
I just don't think this optimization is a good one.

> C doesn't have the sort of sort function that makes this possible in the
> first place, nor does it have the sort of data that makes it a reasonable
> thing to do. Perl does, so some optimization is reasonable. Whether it's a
> good first spot to optimize is an open question, but it will be a big win
> for quite a few people.

C has qsort() and bsearch(). Anyway, I will not put it on my optimization
list.

> >Though Pascal/Ada have distinctions
> >like function/procedure, it does not make them any faster than C.
>
> Depends on how the function's written in C. A function that has no
> meaningful return yet still returns one which gets inevitably thrown away
> will cost more than one that never returns anything, and there is a
> tendency to return *something* since you can.

The function in Ada can not have any side effect, i.e. no change to globals.
The procedure can have side effect. It gives compilers some more chances
for optimizations. For example (pseudo code),
  function comp(int n, int m) : int;
the compiler can safely remember the result of comparison for the same
arguments.

Hong


Reply via email to