emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lexical mumblings


From: Miles Bader
Subject: Re: lexical mumblings
Date: 30 Oct 2001 10:00:42 +0900

Andrew Innes <address@hidden> writes:
> PS. One of the disappointments I have about lexical binding (I'm talking
> about the byte code level now) is that it is unlikely to yield any great
> performance improvement, which has always seemed to me to be the
> greatest incentive for such a deep change.

Actually I've seen a nice speed improvement from simply moving `let'
statements out of loops, and using setq instead, e.g.

     (dolist (...) (let ((x ...)) ...))
  =>
     (let (x) (dolist (...) (setq x ...) ...))

Clearly this sort of silly thing becomes unnecessary with lexical
binding, indeed, binding then has _zero_ cost (at least using the
implementation I suggested).

For me, the main benefit is a psychological one -- I want to be able to
use let-binding freely, without the nagging feeling that I'm giving up a
bit of speed each time I do.

There are other benefits too, of course -- the compiler would finally be
free to do a bit more optimization if anyone cared to make it do so, and
writers of functions that accept functions as arguments wouldn't have to
play the stupid `try to pick local variable names that won't clash with
your caller' game.

I think the point of this current exercise though, is that it really
_isn't_ a `deep change'.  It's more like adding a flashy new widget on
the side -- sure it requires a few tweaks in central places, but no
major modifications to the current scheme.

-Miles
-- 
Run away!  Run away!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]