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: Re: On elisp running native Date: Sun, 26 Apr 2020 12:00:46 +0000 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: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="125216"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: Eli Zaretskii , Stefan Monnier , emacs-devel To: yyoncho Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 26 14:01:49 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 1jSfym-000WU8-76 for ged-emacs-devel@m.gmane-mx.org; Sun, 26 Apr 2020 14:01:48 +0200 Original-Received: from localhost ([::1]:57656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSfyl-0004rs-6j for ged-emacs-devel@m.gmane-mx.org; Sun, 26 Apr 2020 08:01:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59760) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSfxu-00047G-MJ for emacs-devel@gnu.org; Sun, 26 Apr 2020 08:00:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSfxt-0004jm-Uc for emacs-devel@gnu.org; Sun, 26 Apr 2020 08:00:54 -0400 Original-Received: from mx.sdf.org ([205.166.94.20]:61283) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jSfxt-0004Gi-C5; Sun, 26 Apr 2020 08:00:53 -0400 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 03QC0kl6009790 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Sun, 26 Apr 2020 12:00:46 GMT Original-Received: (from akrl@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 03QC0kCP001787; Sun, 26 Apr 2020 12:00:46 GMT In-Reply-To: (yyoncho@gmail.com's message of "Tue, 25 Feb 2020 08:14:02 +0200") Received-SPF: pass client-ip=205.166.94.20; envelope-from=akrl@sdf.org; helo=mx.sdf.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/26 08:00:47 X-ACL-Warn: Detected OS = ??? 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:247829 Archived-At: yyoncho writes: > Hi, > > I did benchmarks of json parsing here 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 avg 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 343 | =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.31 | =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 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 > =C2=A0 =C2=A0 (insert-file-contents-literally =C2=A0"benchmarks/sample.js= on") > =C2=A0 =C2=A0 (buffer-string))) > > > (defun elb-json-parsing-entry () > =C2=A0 (cl-loop repeat 1000 > =C2=A0 do (json-read-from-string json-parsing-input))) > > Thanks, > Ivan Hi Ivan, I've got time to re-look into this. The perf difference was due to GC time (as Eli pointed out all json computation is in the C world). I believe this delta was due to the greater number of objects allocated in the native comp variant with the consequent more time needed to traverse them during GC. Since these measures I've made several changes to reduce the number of unnecessary live objects. Repeating the test on the current native-comp against master I see on my machine a performance delta of 2% in favor of master. Considering I expect this effect to fade out on a real session with more allocated objects I consider this being acceptable. Andrea --=20 akrl@sdf.org