[plt-scheme] Native code generation and immutable pairs
On 3/10/06, Greg Woodhouse <gregory.woodhouse at sbcglobal.net> wrote:
> --- Jim Blandy <jimb at red-bean.com> wrote:
>
> > (I'm probably being too terse here; I don't really believe that a
> > language without mutable pairs is "unusable", or that C-competitive
> > performance in every case is somehow requisite. But in trying to
> > think about where to take the language, I find it an unpleasant
> > choice.)
>
> I don't think you want to give up performance. I've just spent a week
> with a product with Oracle, WebLogic and a web based application all
> deployed on a single box. Even though I'm not interested in number
> crunching per se, the performance issues were painful. I also wouldn't
> want to write off "C-like" performance as unattainable, because if
> people are going to use Scheme, they're going to need to be able to do
> the same kinds of things they do other languages.
Well, you want to be careful about this. Speed is a subtle thing.
- When Perl was the hot new thing, you'd hear people saying from time
to time that they'd rewritten their C program in Perl and it got
faster. I never looked into any of these stories myself, but I
believe they're true; Perl's carefully tuned string handling and
regexp matching are probably faster than straighforward C code in some
cases.
- If you read Paul Graham's essays on using Lisp in his Viaweb
startup, http://www.paulgraham.com/avg.html, you'll see that the
advantage attributed to Lisp wasn't speed --- it was development time.
That's what helped him win.
- I've worked on the Project GNU debugger, GDB, for eight years now
(ugh, finally I'll be able to branch out a bit), and I would much
rather implement a debugger in Scheme than C. It turns out that many
of the features you hear people say are most "expensive" in Scheme ---
garbage collection, generic arithmetic and first-class continuations
--- are all pretty much critical for the kinds of things a debugger
wants to do. I'm pretty confident GDB is *slower* because it uses
crummy techniques to approximate those features than an implementation
in a good Scheme that simply used the features of the language.
Which is why I tried to qualify my statement the way I did. C doesn't
give you performance; it gives you control. Exercising that control
to get high performance can take more time or brains than you've got.
Expressivity can be more important --- that's not just something
Schemers say to make themselves feel better.
To your example: aren't Oracle and WebLogic written in C? It's the
design, not the language. If they'd used a "slower" but more
expressive language, would they have been able to implement a design
which was faster overall?