[PRL] Bob Harper's new blog

Joe Marshall jmarshall at alum.mit.edu
Thu Mar 17 15:20:13 EDT 2011


On Thu, Mar 17, 2011 at 12:03 PM, David Herman <dherman at ccs.neu.edu> wrote:
>
> I also still find the 90% figure incredibly high.

It matches my experience as well.

>Your point about loops is fair; it certainly does help inflate the number.

FP usually has exactly 1 mechanism for control transfer:  the procedure call.

Imperative programming usually has dozens.  Imperative programming
emphasizes looping and element-at-a-time iteration as the basic
means of combination, so they tail-call a *lot*.  But since the language
is thoroughly broken, they cannot optimize tail calls without help from
the programmer (who instead tries to fit his design into the mold of
a for loop or while loop).

Essentially, in an imperative language, 90% of what you do dynamically
is iterate.  Thus 90% of the calls are actually jumps to the beginning
of the iteration construct.  These are optimized tail calls, but they
are only optimized in Java because you used `while' or `for' to
express them.

> But I would not be surprised if the number is highly variable
> depending on the community and application domain.

Empirically, there is much less variability than you'd expect.

-- 
~jrm



More information about the PRL mailing list