From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: On elisp running native - deferred compilation Date: Sat, 22 Feb 2020 10:15:50 +0000 Message-ID: References: <83tv5mp48l.fsf@gnu.org> <83sgl0lchm.fsf@gnu.org> <83imlwl9vm.fsf@gnu.org> <83o8uegykm.fsf@gnu.org> <74dd94a9-28cb-a5fd-dbc7-ab21009834ad@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="5260"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 22 11:16:27 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j5Rpj-0001Gv-Kt for ged-emacs-devel@m.gmane-mx.org; Sat, 22 Feb 2020 11:16:27 +0100 Original-Received: from localhost ([::1]:41118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5Rpi-0001si-Ki for ged-emacs-devel@m.gmane-mx.org; Sat, 22 Feb 2020 05:16:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48405) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5RpF-0001Rw-VG for emacs-devel@gnu.org; Sat, 22 Feb 2020 05:15:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5RpE-0007nH-MC for emacs-devel@gnu.org; Sat, 22 Feb 2020 05:15:57 -0500 Original-Received: from mx.sdf.org ([205.166.94.20]:54827) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j5RpE-0007jN-FL for emacs-devel@gnu.org; Sat, 22 Feb 2020 05:15:56 -0500 Original-Received: from sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 01MAFo3m018148 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Sat, 22 Feb 2020 10:15:50 GMT Original-Received: (from akrl@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 01MAFoZU027994; Sat, 22 Feb 2020 10:15:50 GMT In-Reply-To: (Andrea Corallo's message of "Sun, 16 Feb 2020 18:18:01 +0000") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 205.166.94.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245029 Archived-At: Hi all, It's a couple of days that an idea is spinning in my head. I think we could imagine the following mechanism: 1- When an .elc is loaded when no .eln is present we load the .elc but we enqeue an async compilation using 'native-compile-async'. The async compilation queue is eaten by a configurable number of parallel processes. 2- When each compilation unit is finished compiling we substitute each byte-compiled function definition with the new one. I think we already have most of the infrastructure for that. The missing (and a little tricky) part is that we would have to avoid redefining functions that after the first load got already redefined for some reason. In a sense we would have something like a jitter (with a per compilation unit granularity) but in contrast with the conventional jitter approach we would have .eln already compiled at the next run avoiding having to boil the same water again. I think such mechanism would work very well when installing packages without having to freeze for compiling. But we could also introduce a new build target where we native compile only preloaded files. This would bring down compile time of one magnitude order. It's just a (possibly completely broken) idea so I'd like to hear opinions. Thanks Andrea -- akrl@sdf.org