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 19:22:34 +0300 Message-ID: <83wojm57sl.fsf@gnu.org> References: <87sh806xwa.fsf@chapu.is> <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> <83ftqa8qsg.fsf@gnu.org> <83muki6y6r.fsf@gnu.org> <4b8c6799-e845-768b-749c-f2a883ab89f8@yandex.ru> <83h8aq6v6a.fsf@gnu.org> <834l6q6ozn.fsf@gnu.org> <83zhoi59ao.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="178127"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 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 18:38:12 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 1hIbxM-000kC1-1q for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Apr 2019 18:38:12 +0200 Original-Received: from localhost ([127.0.0.1]:39899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIbxL-0005n5-0J for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Apr 2019 12:38:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIbuk-0003R7-CW for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 12:35:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIbig-0003Y5-Kp for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 12:23:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37826) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIbig-0003Xc-7V for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 12:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hIbif-0003Uc-RL for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2019 12:23:01 -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 16:23:01 +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.155595017313409 (code B ref 31138); Mon, 22 Apr 2019 16:23:01 +0000 Original-Received: (at 31138) by debbugs.gnu.org; 22 Apr 2019 16:22:53 +0000 Original-Received: from localhost ([127.0.0.1]:51370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIbiW-0003UC-Re for submit@debbugs.gnu.org; Mon, 22 Apr 2019 12:22:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIbiV-0003Tz-GR for 31138@debbugs.gnu.org; Mon, 22 Apr 2019 12:22:51 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIbiP-0003BT-2k; Mon, 22 Apr 2019 12:22:45 -0400 Original-Received: from [176.228.60.248] (port=2668 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hIbiO-0000rh-H4; Mon, 22 Apr 2019 12:22:44 -0400 In-reply-to: (message from Dmitry Gutov on Mon, 22 Apr 2019 19:00:13 +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:158057 Archived-At: > Cc: sebastien@chapu.is, yyoncho@gmail.com, 31138@debbugs.gnu.org > From: Dmitry Gutov > Date: Mon, 22 Apr 2019 19:00:13 +0300 > > On 22.04.2019 18:50, Eli Zaretskii wrote: > > (You should have used > > insert-file-contents-literally instead.) (And, to answer your question: insert-file-contents doesn't use code_convert_string, it decodes text as it being read, directly in the buffer's gap.) > I wonder if there's a counterpart for that for HTTP responses returned > by url-retrieve. There is, if we need: bind coding-system-for-read to 'no-conversion'. > > And I don't think we will be > > able to speed up the general-purpose decoding routines: no one said > > the original file is encoded in UTF-8. > > We could speed up certain important cases, like where the bytes are > identical between the source and the destination. Not sure what you mean by "source" and "destination". In any case, coding.c is already heavily optimized, certainly in the UTF-8 case. You and others are welcome to profile the code looking for opportunities to optimize even more, but I'd be surprised if you find something significant. In particular, UTF-8 decoding validates as part of the decoding loop, and is already optimized for ASCII, so it will be interesting to see what kind of gains we could have in json_make_string by testing for ASCII up front.