From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wojciech Meyer Newsgroups: gmane.emacs.devel Subject: Re: Compiling Elisp to a native code with a GCC plugin Date: Tue, 14 Sep 2010 21:52:12 +0100 Message-ID: <87bp803v5v.fsf@gmail.com> References: <87bp805ecr.fsf@gmail.com> <874ods5ctf.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1284497594 5120 80.91.229.12 (14 Sep 2010 20:53:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 14 Sep 2010 20:53:14 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 14 22:53:13 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OvcV1-0005bd-W9 for ged-emacs-devel@m.gmane.org; Tue, 14 Sep 2010 22:53:08 +0200 Original-Received: from localhost ([127.0.0.1]:47115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvcV1-0000Np-Fj for ged-emacs-devel@m.gmane.org; Tue, 14 Sep 2010 16:53:07 -0400 Original-Received: from [140.186.70.92] (port=38662 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvcUw-0000Nk-6p for emacs-devel@gnu.org; Tue, 14 Sep 2010 16:53:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvcUs-0003Bd-VA for emacs-devel@gnu.org; Tue, 14 Sep 2010 16:53:02 -0400 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:40351) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvcUs-0003BX-Lc for emacs-devel@gnu.org; Tue, 14 Sep 2010 16:52:58 -0400 Original-Received: by wwb24 with SMTP id 24so8647617wwb.30 for ; Tue, 14 Sep 2010 13:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=+Fe2yQ62srfPtUlwJZn+t1xaVkar7DgjIJcwtQmelus=; b=ONiKZPIzOESqQ4wNeAjRvvpq1wF8f0jels3UYhQQUoMCLtC3AuxB7KtNFiCciSA0U9 mznvbGCqXlgz3y3cOkkFPsTUgUrPQzCNNL97tcjNL/W1J1eTrMZ13s3G4tha8tVPxcLY hNVWUH3Dcpt0TCZXExhLi1e+ydrE0Z2CuWj1M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; b=U+Xr7Tv+h6R9qa51j2/p+pv2Wv+XeuHV6lQ8cX+urwkkzoNi+BKFrz2/l8PBM2NTag IvKLDr6kga0g4YfjltHVj+/MU+pvemNLIsZjqPpYxb2XFpLmBskdvy0e2L3XZOKgeDJH 6rXVW37tcoy8zQ/fknKMI6MIoi8m68nsy+9zE= Original-Received: by 10.227.131.68 with SMTP id w4mr335550wbs.225.1284497577651; Tue, 14 Sep 2010 13:52:57 -0700 (PDT) Original-Received: from spec-desktop.specuu.com (host86-133-35-46.range86-133.btcentralplus.com [86.133.35.46]) by mx.google.com with ESMTPS id m25sm531913wbc.19.2010.09.14.13.52.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 14 Sep 2010 13:52:52 -0700 (PDT) In-Reply-To: (Lars Magne Ingebrigtsen's message of "Tue, 14 Sep 2010 22:17:42 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:130150 Archived-At: Lars Magne Ingebrigtsen writes: > To take a random example from code I just wrote (part of > `gnus-range-nconcat'), which works on lists and numbers and stuff, and > is as low-level as Emacs Lisp code gets: > > (when (numberp (car last)) > (setcar last (cons (car last) (car last)))) > (if (= (1+ (cdar last)) (caar range)) > (progn > (setcdr (car last) (cdar range)) > (setcdr last (cdr range)))) > > Just imagine what that would be in native code, as opposed to byte code. > In either case, it'd just be a lot of calls to Fcar, Fcons, Fsetcar and > so on. Would the byte-interpreter call those functions a lot slower > than native code would? I kinda doubt it. Some of the functions will be in-lined, some of the data pointers will be loaded to registers, some of the calls will be specialised against constants, some of the expressions simplified, the flat code peep-holed etc. So no, it is not direct translation even at the level of byte-code, and compiler frameworks (gcc & llvm) are getting better and better at optimising at high-level and low-level. Wojciech