From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#31138: Native json slower than json.el Date: Tue, 23 Apr 2019 17:22:34 +0300 Message-ID: <6308ceff-479b-2ce7-2072-41e683978c7c@yandex.ru> References: <87sh806xwa.fsf@chapu.is> <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> <83wojm57sl.fsf@gnu.org> <83ftq96azk.fsf@gnu.org> <83wojk534g.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="33212"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Cc: sebastien@chapu.is, yyoncho@gmail.com, 31138@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 23 16:25:22 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 1hIwMM-0008UP-9N for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Apr 2019 16:25:22 +0200 Original-Received: from localhost ([127.0.0.1]:54544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIwML-0006fy-8W for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Apr 2019 10:25:21 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIwM6-0006cI-Km for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 10:25:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIwK6-0004xv-2D for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 10:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40399) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIwK5-0004xr-VM for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 10:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hIwK5-0000QB-O5 for bug-gnu-emacs@gnu.org; Tue, 23 Apr 2019 10:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Apr 2019 14: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.15560293651592 (code B ref 31138); Tue, 23 Apr 2019 14:23:01 +0000 Original-Received: (at 31138) by debbugs.gnu.org; 23 Apr 2019 14:22:45 +0000 Original-Received: from localhost ([127.0.0.1]:53943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIwJp-0000Pc-0D for submit@debbugs.gnu.org; Tue, 23 Apr 2019 10:22:45 -0400 Original-Received: from mail-wr1-f51.google.com ([209.85.221.51]:35112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hIwJn-0000PQ-UY for 31138@debbugs.gnu.org; Tue, 23 Apr 2019 10:22:44 -0400 Original-Received: by mail-wr1-f51.google.com with SMTP id o12so17155009wrn.2 for <31138@debbugs.gnu.org>; Tue, 23 Apr 2019 07:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=suwcfV/AfBHKcjYtwaVPhgaOQ+yRxrdSLIgwAHTau9Y=; b=Yuj1NlcSMj4ESMQCeKdJ5Vn24HByHgX7pjKE8njEa6am8ZmQPVOvPasiWosPVlPa9C ocCV/JZcdoVNMd6cXqQWrpZvAhtO9dsPzXHU7jYv7NHQrPGLvzugdh8Ewq8b9cZImuBM stcMTDGtZe8TN5T3Fp8jn5Xf7KR1uJAOTulOmI0Uy1BfnT0xkTpUC/5RGfhrKvWDM00x 0vYKFSDXbHj+7luPDexwmRom1Ukj1m7e/t03rP9Cn8sc0iZxBeBVLo91Kw7rAPHXdRvf 91PTGTBCpLXt24DNmMugMEF2zy2ABpx2ZiT8id9x0/Luv+vgRQZRLXuZy04PA9VRuR8P TDQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=suwcfV/AfBHKcjYtwaVPhgaOQ+yRxrdSLIgwAHTau9Y=; b=c08dND2QefZUYZWehsapCzEOjUKYhwyiQ1L75tfG1ZDGNXeK66ogRPMLjj3qEOD0z9 qpHu/2V1DtF1dyzfcoUpJq2ijFStC1TT4sUZqFJJFmKZ4FJF7MdEBQ7eH9cRFHh/FBrV bIpyadG3OnI2ZpQUMwbpVOEGNVVchN0T0tZV9xJolpsirnLU55+6mkhheGvwFds3vkRf szaK5fDR6hl3u5NuqqdNbU96t0bKb2TtOoI98pq9ophtybtkYoKEsPGAtFAJBCWVuUFb BixA+eAhBrrtmwMMC29bVxgr9xJ9h+OOME8oK/xVnxsG33J5YYQxYlAiJdat+r/io2qI Meqg== X-Gm-Message-State: APjAAAW4QhiSt1f0Zxe59oSs6DACG/LzbBDQXEm8YePk+XBlafaURz1e FbXrEmVTir7PmCmnDvs4fUxlIA+y X-Google-Smtp-Source: APXvYqz28k2YIAXx+SBkC9YvEx6a+6TQ2bkKH3IkeCtLE18VXkF85+pSY0YPOiVfkZq4kvDjHJ4ToA== X-Received: by 2002:adf:c743:: with SMTP id b3mr16115020wrh.261.1556029357550; Tue, 23 Apr 2019 07:22:37 -0700 (PDT) Original-Received: from [192.168.0.195] ([109.110.245.170]) by smtp.googlemail.com with ESMTPSA id 204sm19220367wmc.1.2019.04.23.07.22.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Apr 2019 07:22:35 -0700 (PDT) In-Reply-To: <83wojk534g.fsf@gnu.org> Content-Language: en-US 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:158136 Archived-At: On 23.04.2019 15:15, Eli Zaretskii wrote: > I thought about this. It could make sense to have a UTF-8 specific > function to encode and decode strings. With encodings other than > UTF-8 it becomes trickier, and probably likewise with buffer text, > where we need to take the gap into account. Doing that for buffer text as well might be helpful. Other encodings are much less of a priority, I would say. > What applications do we have where en/decoding strings has critical > effect on performance? It wouldn't be critical most of the time, but even a few % performance improvement across the board, basically for free, might be welcome. So that's why I mentioned decode-coding-string (though code_convert_string would be a better choice; or decode_coding_object?), as opposed to creating a new specialized function. What I can understand from our testing, this kind of change improves performance for all kinds of strings when the source encoding is utf_8_unix. Even for large ones (despite you expecting otherwise). The only kinds of input where this should result in a (likely minor) slowdown would be ones where the contents do not correspond to the declared encoding. Again, the patch, or several, shouldn't be particularly hard to write, and we can try them out with different scenarios.