What If Python Replaced Elisp?
tim_one at email.msn.com
Fri Mar 10 02:54:00 CET 2000
[posted & mailed]
[taashlo at sandia.gov]
> (If you're tempted to post a followup saying something like "Doing
> this would be a waste of time and effort", don't. Just accept that
> you've missed the point of this posting and move on.)
Believe it or not, I actually read that paragraph <wink>.
> But is Python fast enough to be a scripting engine for an editor?
> (Beginner WAG: Python 'feels' just as fast, if not faster, than
> Elisp. But some of the packages (e.g. font-lock) rely heavily on
> regular expression parsing, which may be slower in Python.)
Regexps are done by library pkgs coded in C -- in the end, all regexp pkgs
will be exactly the same speed <0.5 wink>.
I wrote the first "heavy" Emacs Python mode (its descendant is still the
real deal), and last year redid the parsing parts of that in Python for IDLE
(Guido's 100% Python-on-Tk Python IDE). This was a challenge! "This"
meaning both of them <wink>.
The IDLE code was much easier to write, despite that my only access to the
editing buffer was thru a straw sucking it reluctantly out of Tk's text
widget as a sequence of more-or-less giant strings. Didn't matter -- it was
easy to hide most of the pain in Python.
However, speed was a real problem, and it took much more "cleverness" to
give the illusion of instantaneous response under IDLE. But raw elisp isn't
fast enough for this task either! That's why elisp exposes a bunch of
table-driven parsing functions coded in C. I didn't have that option with
Major language modes are substantial pieces of subtle work, so I think this
is a good point of comparison. elisp worked fine for the task, and in
several respects has special support for it. Python also worked fine, with
no special support for it. Both languages required some tricks to get
acceptable speed in extreme cases, although the most valuable of those
tricks have worked their way into elisp's out-of-the-box repertoire over the
python-is-fast-enough-for-anything-it-isn't-too-slow-for-ly y'rs - tim
More information about the Python-list