From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: yyoncho Newsgroups: gmane.emacs.devel Subject: Re: On elisp running native Date: Tue, 25 Feb 2020 08:14:02 +0200 Message-ID: References: <838smzq9iz.fsf@gnu.org> <8336d6rfgy.fsf@gnu.org> <83woagonl9.fsf@gnu.org> <83sgl4ojci.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000975021059f6065e6" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="117022"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier , emacs-devel To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 25 07:14:52 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 1j6TUa-000UGn-0n for ged-emacs-devel@m.gmane-mx.org; Tue, 25 Feb 2020 07:14:52 +0100 Original-Received: from localhost ([::1]:49436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6TUZ-0007YL-3V for ged-emacs-devel@m.gmane-mx.org; Tue, 25 Feb 2020 01:14:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34374) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6TU4-00075c-7B for emacs-devel@gnu.org; Tue, 25 Feb 2020 01:14:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6TU2-0008AM-KR for emacs-devel@gnu.org; Tue, 25 Feb 2020 01:14:20 -0500 Original-Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]:37079) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j6TTz-00088U-RJ; Tue, 25 Feb 2020 01:14:16 -0500 Original-Received: by mail-lj1-x236.google.com with SMTP id q23so12721031ljm.4; Mon, 24 Feb 2020 22:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=at3TohJJR5sl+yQvwrmG0gTOQvamvS8tR+uWk6aJB1I=; b=rnpWx4bI4IjDID4MLYfJjXjT6EVlX1AApLwihSbd24Zxh8LTJbgsXQJo85x3+lcJY3 r57gt6bzCkEPOkuADELzgztS6hkO0YwoZPwtUY+FGL4QP/g9fgJ1xhR4ZhsBL3Uqen5H ROPsi6lat4HESTcKStpGXXo7ktAQ1KJCCf/1fX0YlS8l/bsMwROTUjH5ebOm7ufDPpPO I/evY5Z/YPXZ1yko9sJqf8X0DMV27CTtR0Zd+HJTq4MECQMVLK3Lzt3cch4/50Spy2r5 aBjyJvFc8migiqkvck4u2pY6N3UnPagxRFXU7q7LSFBa6qeEuQ2feR2LL7ZqYGTBtUcs Id1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=at3TohJJR5sl+yQvwrmG0gTOQvamvS8tR+uWk6aJB1I=; b=r0XD8KY4Z5IHJDe4OANRHTTPmQWEKo8DzTXx9Z3yV1MEzS4Qj0Tw9LeDg75YlRPSy/ sdJDqb/N8TY7w/fxw0xKCeKEbzN7IruGqVATdizX5W7RZlpsKZBCNSFJrUqZDRhufi/s sVGFTVAwjqecpC97f1g2XjrdB0o0sA9hbXbunO1osuIls4bnNKLHyvkQxPdCng9YJELx azZp3dFAHPF6WCPL2gftc/qQAzXSg8Kcz575mcdeZ0P/e2rRq939VXPTDlbVbX5mziwz MnXZUXIBhZ6ZE/dcLDZAjePC7FCFB3O67N9JzH+nwQ3V3dmS8h6MRg9+ccu7SzQdIAcR XQyA== X-Gm-Message-State: APjAAAVRBkNVXIfpi4oD/SggU4YQYdtRNkgTUN4/d+PQCF1rioqMp7BM aQRNOYGhKugrl/ws2Sox/H71BJ2VWRUnCa5KfWY= X-Google-Smtp-Source: APXvYqyk/Obp4uqFVVsWy6480J8dziQ/9l1y1nDk+iDUSO1hcD7pSLsSHX80zBY3uvfvhDOvk+z5RYNUsqYd5UtFCuo= X-Received: by 2002:a2e:b530:: with SMTP id z16mr32281177ljm.216.1582611253643; Mon, 24 Feb 2020 22:14:13 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::236 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:245059 Archived-At: --000000000000975021059f6065e6 Content-Type: text/plain; charset="UTF-8" Hi, I did benchmarks of json parsing here it is what I get: | test | non-gc avg (s) | gc avg (s) | gcs avg | tot avg (s) | tot avg err (s) | |--------------+----------------+------------+---------+-------------+-----------------| | json-parsing | 2.57 | 3.32 | 318 | 5.89 | 0.10 | |--------------+----------------+------------+---------+-------------+-----------------| | total | 2.57 | 3.32 | 318 | 5.89 | 0.10 | Native: | test | non-gc avg (s) | gc avg (s) | gcs avg | tot avg (s) | tot avg err (s) | |--------------+----------------+------------+---------+-------------+-----------------| | json-parsing | 1.71 | 4.31 | 343 | 6.02 | 0.01 | |--------------+----------------+------------+---------+-------------+-----------------| | total | 1.71 | 4.31 | 343 | 6.02 | 0.01 | It looks like this is bellow the average speedup you might wanna take a look: Here it is the benchmark code: (require 'cl-lib) (require 'json) (defvar json-parsing-input (with-temp-buffer (insert-file-contents-literally "benchmarks/sample.json") (buffer-string))) (defun elb-json-parsing-entry () (cl-loop repeat 1000 do (json-read-from-string json-parsing-input))) Thanks, Ivan On Tue, Feb 25, 2020 at 1:21 AM Andrea Corallo wrote: > Eli Zaretskii writes: > > >> From: Andrea Corallo > >> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org > >> Date: Sat, 28 Dec 2019 08:56:17 +0000 > >> > >> Eli Zaretskii writes: > >> > >> > I'm not sure I understood you, but dlopen, dlsym etc. (or their moral > >> > equivalents) are readily available on Windows; see src/dynlib.c. So > >> > that cannot be the reason why libgccjit is not available on Windows. > >> > >> Sure, but libgccjit AFAIU just calls directly dlopen > >> (gcc/gcc/jit/jit-playback.c:2650). > > > > That's OK. One of the MinGW flavors actually provides these functions > > directly; for the other it should be easy to write them so that > > libgccjit can call them. > > > >> I've just found this interesting old thread: > >> > >> https://gcc.gnu.org/ml/jit/2015-q3/msg00124.html > > > > Thanks. Not sure what to make from that, especially since AFAIK the > > Windows code is PIC by default. The problems they are talking about > > are very easy to solve, but somehow no one has yet solved them. Which > > might mean there's more to it than meets the eye. (However, I'm > > talking out of sheer ignorance, so perhaps you should ask on the GCC > > list whether there are any fundamental problems with providing > > libgccjit on Windows.) > > I just bumped in this Chinese blog where the guy apparently is running > the native-comp branch on Windows 10 using mingw64: > > http://www.albertzhou.net/blog/2020/01/emacs-native-comp.html > > To a quick look in libgccjit he had to modify the dlopen&friends part > and added some handling for temporary files. In Emacs comp.c code he > touched some setjmp code. > > I know zero about Windows but this should help answering the question if > this port is possible and what's roughly the effort. > > Andrea > > -- > akrl@sdf.org > > --000000000000975021059f6065e6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I did benchmarks of json parsing he= re it is what I get:

=C2=A0 | test =C2=A0 =C2=A0 =C2=A0 =C2= =A0 | non-gc avg (s) | gc avg (s) | gcs avg | tot avg (s) | tot avg err (s)= |
=C2=A0 |--------------+----------------+------------+---------+------= -------+-----------------|
=C2=A0 | json-parsing | =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 2.57 | =C2=A0 =C2=A0 =C2=A0 3.32 | =C2=A0 =C2=A0 318 | =C2=A0= =C2=A0 =C2=A0 =C2=A05.89 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00.10 |=
=C2=A0 |--------------+----------------+------------+---------+--------= -----+-----------------|
=C2=A0 | total =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 2.57 | =C2=A0 =C2=A0 =C2=A0 3.32 | =C2=A0 = =C2=A0 318 | =C2=A0 =C2=A0 =C2=A0 =C2=A05.89 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A00.10 |


Native:

=C2=A0 | test =C2=A0 =C2=A0 = =C2=A0 =C2=A0 | non-gc avg (s) | gc avg (s) | gcs avg | tot avg (s) | tot a= vg err (s) |
=C2=A0 |--------------+----------------+------------+------= ---+-------------+-----------------|
=C2=A0 | json-parsing | =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 1.71 | =C2=A0 =C2=A0 =C2=A0 4.31 | =C2=A0 =C2=A0 3= 43 | =C2=A0 =C2=A0 =C2=A0 =C2=A06.02 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A00.01 |
=C2=A0 |--------------+----------------+------------+------= ---+-------------+-----------------|
=C2=A0 | total =C2=A0 =C2=A0 =C2=A0= =C2=A0| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1.71 | =C2=A0 =C2=A0 =C2=A0 4.3= 1 | =C2=A0 =C2=A0 343 | =C2=A0 =C2=A0 =C2=A0 =C2=A06.02 | =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A00.01 |

It looks like t= his is bellow the average speedup you might wanna take a look:
Here it is the benchmark code:

(requi= re 'cl-lib)
(require 'json)

(defvar json-parsing-input (w= ith-temp-buffer
=C2=A0 =C2=A0 (insert-file-contents-literally =C2=A0= "benchmarks/sample.json")
=C2=A0 =C2=A0 (buffer-string)))<= br>

(defun elb-json-parsing-entry ()
=C2=A0 (cl-loop repeat 1000<= br> =C2=A0 do (json-read-from-string json-parsing-input)))
<= br>
Thanks,
Ivan

On Tue, Feb 25, 2020 at 1:21 AM A= ndrea Corallo <akrl@sd= f.org> wrote:
Eli Zaretskii <el= iz@gnu.org> writes:

>> From: Andrea Corallo <akrl@sdf.org>
>> Cc: = monnier@iro.umontreal.ca, emacs-devel@gnu.org
>> Date: Sat, 28 Dec 2019 08:56:17 +0000
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > I'm not sure I understood you, but dlopen, dlsym etc. (or= their moral
>> > equivalents) are readily available on Windows; see src/dynlib= .c.=C2=A0 So
>> > that cannot be the reason why libgccjit is not available on W= indows.
>>
>> Sure, but libgccjit AFAIU just calls directly dlopen
>> (gcc/gcc/jit/jit-playback.c:2650).
>
> That's OK.=C2=A0 One of the MinGW flavors actually provides these = functions
> directly; for the other it should be easy to write them so that
> libgccjit can call them.
>
>> I've just found this interesting old thread:
>>
>> https://gcc.gnu.org/ml/jit/2015-q3/msg001= 24.html
>
> Thanks.=C2=A0 Not sure what to make from that, especially since AFAIK = the
> Windows code is PIC by default.=C2=A0 The problems they are talking ab= out
> are very easy to solve, but somehow no one has yet solved them.=C2=A0 = Which
> might mean there's more to it than meets the eye.=C2=A0 (However, = I'm
> talking out of sheer ignorance, so perhaps you should ask on the GCC > list whether there are any fundamental problems with providing
> libgccjit on Windows.)

I just bumped in this Chinese blog where the guy apparently is running
the native-comp branch on Windows 10 using mingw64:

http://www.albertzhou.net/blog/2020/01/= emacs-native-comp.html

To a quick look in libgccjit he had to modify the dlopen&friends part and added some handling for temporary files.=C2=A0 In Emacs comp.c code he<= br> touched some setjmp code.

I know zero about Windows but this should help answering the question if this port is possible and what's roughly the effort.

Andrea

--
akrl@sdf.org

--000000000000975021059f6065e6--