From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#31138: Native json slower than json.el Date: Mon, 22 Apr 2019 16:02:49 +0300 Message-ID: <83k1fm6vly.fsf@gnu.org> References: <87sh806xwa.fsf@chapu.is> <83lg12n75s.fsf@gnu.org> <83h8bqn2ik.fsf@gnu.org> <83zhphliil.fsf@gnu.org> <181b93a3-3861-0481-1b95-8344410d1049@yandex.ru> <83r2a2hdxn.fsf@gnu.org> <21f68973-a684-2a65-82eb-c8f3df90127f@yandex.ru> <83d0lmgez2.fsf@gnu.org> <7d503be9-4d85-3d0b-6829-631ad376ba3d@yandex.ru> <831s22gcci.fsf@gnu.org> <83y349gasn.fsf@gnu.org> <83d0lfag4x.fsf@gnu.org> <5cf45a21-65c3-67ee-f123-be83a6ee7c99@yandex.ru> <83a7gjaen6.fsf@gnu.org> <10ca4e2f-b116-16bc-c81e-24036752c867@yandex.ru> <83lg026xxb.fsf@gnu.org> <0d42dab4-6c5c-be3a-d402-f17b39e7fc3c@yandex.ru> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="260359"; mail-complaints-to="usenet@blaine.gmane.org" Cc: p.stephani2@gmail.com, sebastien@chapu.is, yyoncho@gmail.com, 31138@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 22 15:05:25 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIYdQ-0015c6-Aj for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Apr 2019 15:05:24 +0200 Original-Received: from localhost ([127.0.0.1]:37267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIYdP-0003xn-CQ for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Apr 2019 09:05:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIYc7-0003Lm-Pa for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 09:04:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIYc6-00081i-Ph for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 09:04:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36615) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIYc6-00081V-F7 for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 09:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hIYc6-0006MN-85 for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 09:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Apr 2019 13:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31138 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 31138-submit@debbugs.gnu.org id=B31138.155593818924382 (code B ref 31138); Mon, 22 Apr 2019 13:04:02 +0000 Original-Received: (at 31138) by debbugs.gnu.org; 22 Apr 2019 13:03:09 +0000 Original-Received: from localhost ([127.0.0.1]:50159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIYbF-0006LB-7a for submit@debbugs.gnu.org; Mon, 22 Apr 2019 09:03:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43312) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIYbC-0006Ke-4b for 31138@debbugs.gnu.org; Mon, 22 Apr 2019 09:03:08 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIYb6-0007dr-6p; Mon, 22 Apr 2019 09:03:00 -0400 Original-Received: from [176.228.60.248] (port=2299 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hIYb5-0000Tm-HC; Mon, 22 Apr 2019 09:03:00 -0400 In-reply-to: <0d42dab4-6c5c-be3a-d402-f17b39e7fc3c@yandex.ru> (message from Dmitry Gutov on Mon, 22 Apr 2019 15:24:24 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158029 Archived-At: > Cc: p.stephani2@gmail.com, sebastien@chapu.is, yyoncho@gmail.com, > 31138@debbugs.gnu.org > From: Dmitry Gutov > Date: Mon, 22 Apr 2019 15:24:24 +0300 > > Thank you. Tried it, tests now pass, and the performance improvement is > the same. I compared the same benchmark (100 iterations, GC disabled for > the whole duration), and this patch takes > > src/emacs -Q --batch -l ~/examples/elisp/json-test.el > Elapsed time: 51.153870s > > down to > > $ src/emacs -Q --batch -l ~/examples/elisp/json-test.el > Elapsed time: 26.268435s > > Are you still against it? (Just checking). I'm still against using that patch as is, yes. I'm okay with using make_specified_string if before calling it we make sure the string is plain ASCII or a series of proper UTF-8 sequences. Not sure how much of a performance hit would such tests cost us, but if you are interested, let's time them. (Let me know if you need help in writing the code for the above 2 tests. I think parse_str_as_multibyte should help a lot.) I guess we should also have some test case with non-ASCII characters, if we will introduce these optimizations. Thanks. P.S. I'm still not sure these optimizations will make the OP happy, since at some point I heard them saying that our present performance is abysmally slow and inadequate. If that wasn't a wild exaggeration, then halving the time will still be inadequate. So maybe we should agree in advance whether 30% to 50% improvement will be "good enough", before we embark on this adventure.