help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Why is Elisp slow?


From: Ergus
Subject: Re: Why is Elisp slow?
Date: Fri, 3 May 2019 12:36:44 +0200
User-agent: NeoMutt/20180716

On Fri, May 03, 2019 at 10:06:56AM +0900, ????????? wrote:
I became curious after reading your email :-)

Since implementing a new language/byte interpreter (Guile, for example) is 
hard, and making it fast is harder, why doesn't Emacs leverage the Common Lisp 
environment?????

It is not a language issue I think, but a compiler/interpreter
optimization level.

For example, (since CL and elisp???s syntax is mostly similar) can???t we 
implement Emacs based on CL (looks like there were ongoing efforts before like 
Climacs, Hemlock, etc???) and expose elisp functions in a special package named 
???elisp???????? It would allow elisp compatibility (by running all elisp code 
in the special elisp package) while giving package writers access to CL 
libraries. Since legacy cruft can go inside the package ???elisp???, CL emacs 
APIs can remove/redesign some old APIs and remove technical debt. This would 
also greatly accerlate Emacs speed as CL is super fast especially when using 
with SBCL.

That was the emacs-guile approach. The problem was that nobody finished
it. And if the whole project (means the core and more important
developers) do not decide to go in that direction for a good reason
(like they want to evict the bytecode interpreter from within emacs or
they consider important to use a specific Guile functionality) then it
won't happen. Also, doing big changes like that in emacs core code
becomes a big discussion that takes loooooong time in the mailing list.
Are there any reasons (that I do not know) why CL was not considered or was 
considered but rejected as an elisp alternative?
Are there license problems to build on previous attempts?????

maybe it has to do with this:

https://www.gnu.org/gnu/rms-lisp.en.html

IMHO building emacs on CL would be a wonderful idea... and would fix many 
problems that current Emacs have.

And create others, it is always a trade of.

Any way

I have to say that comparing to other interpreters around the Elisp is
not the slowest one I have tried by far. Of course it could be way
faster, but some optimization like user code and provide new containers
and datatypes in the library level based in C (and recomend them) code
could potentially make more difference in real user extensions.

2019. 5. 3. ?????? 9:44, Ergus <address@hidden> ??????:

WARNING: This email has plenty of personal opinions.

On Fri, May 03, 2019 at 08:39:43AM +0900, ????????? wrote:

Probably (I have a dream) if someone decides to develop a new emacs in
2019 most of the functions and API will be made in pure and clear C (or
any other compiled language), with a full C api that gives the same
access level than what elisp gives in Emacs today (with C lists, arrays
and structs), so it will be not only faster but also simpler to extend
it with other languages like Scheme, Python, Lua, C++, rust and so
on. (There are modules projects going in that direction) And the editor
don't even need to provide a compiler or interpreter for them. (there
will be Guile/gcc/python and so on for that)

This, very much sounds like Guile Emacs. Anyone knows how Guile Emacs
is doing????? It???s very much looks like vaporware these days :-(

Yes, that is the dream (at least the closest we have ever been)

Is upstream considering Guile Emacs as a valid solution?

I made a similar question some time ago and the answer is that there is
not action. :( In fact there is not too much action in
Guile's development .

Not many projects feel interested in Guile because the weak support it
has so there are few users and few developers (But also because
Lisp-like family languages (common Lisp, Scheme and the others) are a
museum piece for young generations that are more used to Python, Ruby,
javascript, and most of OOP (also because there are more jobs with
that))

Actually I think that these days will be easier to find new C/C++
developers for emacs than Lisp developers. Lisp and Scheme are
beautiful, but they require a different way of thinking and a lot of
time (own experience, I am just starting with it.) One reason why I
can't convince my friends to use Emacs is actually how Lisp scares them
((())()'()).

Is there any development ongoing? (Official or not?)
I don't think so :( :( :(. It will require that some core emacs
developers feel more interested in implementing this, because it is a
lot of work... (specially to do it right and keeping the so sacred
backward compatibility) These days only few people know the core parts
of emacs for such a task.

Having Guile as a dependency will grow emacs size significantly
and using it as an external dependency (not usually the emacs way...)
will require to port Guile to more systems (AFAIK). BUt such desition
could benefit very much both projects.

There are even some emacs ports to rust (remacs) but they still have the
elisp as the core languaje. Because most of the code and functionalities
are already in elisp so changing that will be like reimplementing all
emacs from scratch.

(Some time ago there was a lot of effort and time invested in porting C
functions to Elisp in emacs)

So with our actual emacs maybe the JIT or the Lisp->C source to source
is actually the more reliable option in a possible (realistic) future.

Personally I feel the Lisp->C compiler feels like the faster and more
robust solution for me, but it will create a dependency with
binutils... which is for multiple reasons undesired.

The alternative JIT may be based in libJIT which is not very active
either... and has serious issues/limitations that has not been solved in
years.

[1] https://tromey.com/blog/?p=982
[2] https://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00393.html




reply via email to

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