From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Garreau\, Alexandre" Newsgroups: gmane.emacs.help Subject: Re: Why is Elisp slow? Date: Tue, 09 Oct 2018 10:05:43 +0200 Message-ID: <87va6b1r54.fsf@portable.galex-713.eu> References: <638fb7dc-6fc5-4645-8793-97a00038a3a8@googlegroups.com> <8hxojvzzzzzz.m4h.xxuns.g6.gal@portable.galex-713.eu> <20181006192457.GB7368@tuxteam.de> <86lg79yl54.fsf@zoho.com> <86d0slrb4h.fsf@zoho.com> <86pnwkpltx.fsf@zoho.com> <8636tgphps.fsf@zoho.com> <86o9c4np6q.fsf_-_@zoho.com> <8636tfocyl.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1539072253 2450 195.159.176.226 (9 Oct 2018 08:04:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 9 Oct 2018 08:04:13 +0000 (UTC) User-Agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 09 10:04:09 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g9mzx-0000WY-6t for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Oct 2018 10:04:09 +0200 Original-Received: from localhost ([::1]:50147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9n23-0007CY-D2 for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Oct 2018 04:06:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9n1a-0007CE-Cb for help-gnu-emacs@gnu.org; Tue, 09 Oct 2018 04:05:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9n1Y-00084o-G5 for help-gnu-emacs@gnu.org; Tue, 09 Oct 2018 04:05:50 -0400 Original-Received: from portable.galex-713.eu ([2a00:5884:8305::1]:51842) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9n1X-00083B-0N for help-gnu-emacs@gnu.org; Tue, 09 Oct 2018 04:05:47 -0400 Original-Received: from localhost ([::1] helo=portable.galex-713.eu) by portable.galex-713.eu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g9n1T-0001A4-Ew for help-gnu-emacs@gnu.org; Tue, 09 Oct 2018 10:05:43 +0200 X-GPG-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F X-Accept-Language: fr, en, it, eo In-Reply-To: <8636tfocyl.fsf@zoho.com> (Emanuel Berg's message of "Tue, 09 Oct 2018 08:23:30 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:5884:8305::1 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:118226 Archived-At: On 2018-10-09 at 08:23, Emanuel Berg wrote: > Garreau, Alexandre wrote: > >> elisp is mostly interpreted (contrarily to >> C which is always compiled to native code, so >> directly executed by the CPU) and very very >> dynamic afaik > > Why can't Elisp be compiled as well? Afaik it can, as any turing-complete language, that just requires hard work: either writing a full native compiler, or interfacing with one (like gcc). > With "dynamic", do you mean for example one can change a defun, > re-eval it, and the next call, still from the same process, will > execute the new, modified version? > > If so, that's a feature we all love and that's why Elisp is so > addicting because it gives instant feedback. Still, we do it just to a > tiny tiny fraction of mostly our own Elisp. The rest stays the same. For instance. There are other details such as garbage collection / dynamic allocation of everything, having everything on heap, dynamic typing, etc. But it=E2=80=99s not going to be the most important I guess. However being able to change anything (or most things) in emacs is a stated key feature of it, so it makes an full interpreter and the presence of almost all (elisp) sources mandatory, as well as a fast (byte-)compiler. Even more: ideally, to be able to tweak absolutely everything, everything should be in lisp and nothing in C (or the strict minimal to make it portable without having to reinvent the wheel of porting to different architectures in emacs), but afair currently there is still much in C because indeed elisp is too slow, and the most important features are needed to be in C so emacs stays usable. So more work would be needed to give elisp a native compiler=E2=80=A6 the m= ost similar approach I recall are gcl (GNU Common Lisp, common lisp is quite near to elisp) wanting to become a gcc frontend (it=E2=80=99s already compi= ling to C), and Guile proposing to become the elisp engine=E2=80=A6 as guile is normally faster because more optimizations and stuff, it should have made elisp faster, but Guile Emacs is actually slow because, afair, buffer-local variables, dynamic scoping, and low-level stuff like that are bad supported, and in the end there is really few work on it (and Guile is far from being as stable as emacs anyway), so as they want to implement native compilation (but more-or-less (forgot) independently of gcc afair) too, that=E2=80=99d make a native compiler for elisp=E2=80=A6 bu= t as the dynamic stuff is slow on their VM anyway=E2=80=A6